CKnight

  • 21 mars 2020
  • Inscrit 24 juin 2013
  • SOLVED IT! 😃 :rofl:

    It was using the following code to create the skeleton:

    new SkeletonAnimation(_skeleData, true, _stateData);

    The "true" flag I believe forces each slot to be rendered as a mesh, and thus break GPU batching!

    If I use:

    new SkeletonAnimation(_skeleData, false, _stateData);

    It works as expected!

    Silly mistake on my end that took over half a day to solve 🙁

    Happy it is fixed now though!

    Thank you all for the help, I hope to show you some of the Spine animations in the future!

  • bali33 a écrit

    I can't help on this, but in my experience, using Spine + Starling I don't have draw calls issues. If all the animation sprites are in a single SpriteSheet (texture packer for me too) I only have one draw call.

    Thanks for that, sound's like it could be me all along... xD

    Anyhow, I think today I will find out:
    [] Does the standard json output have an effect over the xml atlas export
    [*] What is causing the "batch" flag to be disabled
    [*] If I try some simple characters, will it do the same

    Hopefully it is my fault, :rofl:


    Well I have removed 2 slots from the skeleton, and the draw calls reduced by 2.

    So the slots are relative to the draw calls. Very odd 🙁

    I also checked out the example "starling spine boy" animations, and it had a single draw call.

    Then I checked the "goblin starling" example, and noticed it had over 20 draw calls.

    What is making the goblin have so many draw calls!?!


    Just created my own small animation, THREE DRAW CALLS!!?!

    Could someone verify that it is drawing three calls per frame? 😃

    It has a skin called "TestSkin" that you will need to manually set (we removed the default skin as a test to see if it was the culprit).

  • Thank you Shiu,

    I will jump over to the Starling forum and see if I can find a answer there in the meantime... 🙂

    If it can't be solved, is there a way I can work around having 30 slots in my skeleton? (I assume slots are the core aspect of rendering)

    I have considered frame-by-frame exports, but it would be a massive pain and ruin the immersion 🙁

  • EDIT : Quite sure each slot += draw call 😢

    I have a single character rendered via the Starling framework.

    Yet I have 30 draw calls for a single character even though the texture is packed into an atlas...

    No state changes that I am aware of (such as alpha), smoothing set to "none" even set blend mode to "none"
    as well, finally no meshes.

    Running in release with all the debug code disabled 🙁

    On the Nexus10 two characters can reduce the fps from 60 to under 30.

    Any ideas?

    I have 30 slots in the animation, and it uses 30 draw calls. So my guess is that it is drawing
    each slot with a different batch or something?

    P.S : I ran Adobe Scout profiler, it looks like the problem is to do with uploading data
    to the GPU. But I am using the latest version of Starling, and the draw calls seem way too high.

    Also, I am using an xml version of the Texture-Packer and using the StarlingAtlasAttachmentLoader with it.

    The FPS overlay that comes with starling, certainly does not rack up the draw call amount 😉

    (I was expecting 1 draw call, even on both characters as they share the same atlas, same spine export etc)


    I set a breakpoint in "SkeletonSprite::renderMeshes":

    private function renderMeshes (support:RenderSupport, alpha:Number) : void {
          if (!batchable) {
             _polygonBatch.begin(support, alpha, blendMode);
             addToBatch(_polygonBatch, support, alpha, null);
             _polygonBatch.end();
          } else if (!_batched) {
          [u][b]   support.popMatrix();[/b][/u]
             _polygonBatch.begin(support, alpha, blendMode);
             addToBatch(_polygonBatch, support, alpha, transformationMatrix);
             for(var i:int = parent.getChildIndex(this) + 1, n:int = parent.numChildren; i < n; ++i) {
                var skeletonSprite:SkeletonSprite = parent.getChildAt(i) as SkeletonSprite;
                if (!skeletonSprite || !skeletonSprite.batchable || skeletonSprite.blendMode != blendMode) break;
                skeletonSprite._batched = true;
                skeletonSprite.addToBatch(_polygonBatch, support, alpha, skeletonSprite.transformationMatrix);
             }
             _polygonBatch.end();
             support.pushMatrix();
             support.transformMatrix(this);
          } else
             _batched = false;
       }

    And found that in some-way, batching is disabled.

    Could that be responsible for the high draw count?! And if so, how do I solve it.

  • great, thanks!

  • Thanks for the response but that is what I already am doing.

    The problem is where I have multiple animations within one file - e.g. my character has a walk, attack, knock-back and death - I have to export each state separately. So when the Attack sequence exports at a higher resolution than the Walk sequence, the animation is offset in the game as the center point is different.

  • Is there a way of exporting all of the animations within one spine file at once?

    Exporting different animations produces different image resolutions which causes the animations to be offset in the game, due to each image being rendered from the center of each.

    Being able to export all animations will mean that every frame is the same width and height, so that none of the animations will be offset.

    Currently the developers are having to add manual offset x and y values to solve this |(

    Thanks 8)