riccioverde11

Hello, community,

I'm aware of the Skin functionality for different "aspects" to the same animation.
I would like to know if it also brings any performance advantage or any "better" optimization in the output files.

Unrelated to the Skins, I would also like to know how convenient is to use an idle spine as opposed to an actual png.
The reasoning behind this is:

I would like to make the game more performant by switching off some animations and using a png instead.
Should I just not download the spine at all and use an image or an idle animation is fine?

Obviously, I know I would still load the memory a bit more cause a Spine is larger than a png, but I'm more worried about CPU/GPU performance.

Thanks to anyone who can shed some light on the matter.
riccioverde11
  • 記事: 2

Nate

For drawing a skeleton with a static pose, once you have called Skeleton updateWorldTransform for the pose you want your skeleton to have, you don't need to do that again unless the pose changes. If you want a static skeleton, you don't want an idle animation, you'd just not play any animation instead. That way you don't need to apply an animation every frame, so the pose doesn't change, so you don't need Skeleton updateWorldTransform every frame.

Doing that, the only code that runs is in the skeleton renderer, so you can look at that for the runtime you are using. Rendering a skeleton comes down to checking each slot, if it has a region or mesh attachment, render that. To render, the attachment vertices are multiplied by the bone world transform. This is not usually a huge amount of effort and depends on how many vertex transforms you are doing, but it is more work than draw a PNG.

Drawing a PNG will use less CPU and GPU resources. Whether the difference benefits you depends on what else you are doing and where your bottlenecks are. Consider that if you ever need to draw all the skeletons animated, then your app still needs to perform reasonably when they are all animated so it is maybe not worth trying to optimize for when they are not animated. If you do optimize, you can either render the skeleton as described above and use less resources than when animated, but more than rendering a PNG. Using a PNG has its own challenges, such as where do the PNGs come from, PNGs take up more disk space, etc.

Skins don't affect the rendering of attachments that I described above. The skin is only used to find an attachment when an attachment changes, eg by an animation. The new attachment is set on the slot, then when the skeleton is rendered that slot's attachment is drawn as usual. Skins can affect performance if you are using skin bones or constraints, because when you call Skeleton updateWorldTransform, bones and constraints in a skin are not computed if the skin is not visible. Note this won't affect rendering of a static skeleton because you don't need to call Skeleton updateWorldTransform every frame anyway. See:
Skins - Spine User Guide: Skin bones
アバター
Nate

Nate
  • 記事: 11409

riccioverde11

Thank you for your exhaustive reply. Much appreciated.
riccioverde11
  • 記事: 2


Return to Runtimes