buddhamon

  • Jul 24, 2024
  • Joined Jun 30, 2020
  • The "single atlas" for data export means one atlas for multiple skeletons. The atlas may still have multiple pages if the images don't fit on one page. Each PNG that goes with the atlas data file is a "page".

    There is no setting for reducing the scale until the images can be packed into a single atlas page. Most games would not want their export quality sacrificed like that. You'd need to pack multiple times, reducing the scale each time, until you find the largest scale that packs into a single page.

    If you are packing a PNG export, the atlas having multiple pages usually makes little difference compared to fitting it in a single page. Mainly it takes up more memory but there isn't an issue with draw calls that rendering skeleton data can have when there are multiple pages.

  • ExposedList<Skin> listOfSkins = skeletonAnimation.skeleton.Data.Skins;
    List<Skin> bodySkins = new List<Skin>();
    foreach (Skin skin in listOfSkins) {
        if (skin.Name.Contains("BASE-BODY")) {
            bodySkins.Add(skin);
        }
    }
    

    This look like it would work?

  • Hello. So we are trying to make a randomly generated npc system. We have different parts for each body. We based it on the "mix-and-match-pro" example project.


    I figured out how to assign skins based on my code below:

    [SpineSkin] public string templateSkin;
        [SpineSkin] public string hair;
        [SpineSkin] public string body;
        [SpineSkin] public string shirt;
        [SpineSkin] public string bottom;
        [SpineSkin] public string eyes;
    
    public SkeletonDataAsset skeletonDataAsset;
    
    SkeletonData skeletonData;
    SkeletonAnimation skeletonAnim;
    Skeleton skeleton;
    Skin newSkin;
    
    private void Awake()
    {
        skeletonAnim = GetComponent<SkeletonAnimation>();
        skeleton = skeletonAnim.skeleton;
        skeletonData = skeletonDataAsset.GetSkeletonData(true);
        newSkin = new Skin("temp skin");
        
    }
    
    private void Start()
    {
        Debug.Log(body);
        newSkin.AddAttachments(skeletonData.FindSkin(body));
        newSkin.AddAttachments(skeletonData.FindSkin(bottom));
        newSkin.AddAttachments(skeletonData.FindSkin(shirt));
        newSkin.AddAttachments(skeletonData.FindSkin(hair));
        newSkin.AddAttachments(skeletonData.FindSkin(eyes));
    
        skeletonAnim.skeleton.SetSkin(newSkin);
        skeletonAnim.skeleton.SetSlotsToSetupPose();
        //skeletonAnim.AnimationState.Apply(skeleton);
    }

    Now what I want to know is, is there a way to get a list of the skins in each category so I wouldn't have to type each one of them or assign them as a [SpineSkin] string?

  • Have you tried enabling Write to Depth and setting Depth Alpha Cutoff to 0.0001? This results in nice blended results with no jagged borders (because the cutoff is set to "only discard when alpha <= 0.0001") while still rendering the whole sprite to the depth buffer:


    Magnified view of the Hero character. Enabled depth write provides the correct depth value for the camera blur effect.


    [Edit:]
    Note however that when you use a blur effect and have multiple sprites layered behind each other, then by design you will have problems in non-cut-off areaswhen setting the cutoff threshold to 0.0001 - then a nicely alpha-blended 95% transparent black pixel will receive 95% of the background color, and thus the background pixel will be perfectly sharp (non-blurred) when the character is in focus, where it should be blurry instead.

    Some background pixels around the border wrote to character's depth since they were not discarded at 5% opacity - hence they are not blurry but as sharp as the character.

    In this case you cannot handle this in a single render pass - that's where you need the two different alpha cutoff thresholds:
    1) one that is low enough to not discard the transparent pixel in the first pass, and then
    2) another one at e.g. 0.5 that blurs everything that is mostly transparent and therefore shall count as background.
    This case is where the camera.RenderWithShader() replacement shaders come in handy, since they can render another pass just to write different depth values.