• Unity
  • Frame by frame + skeleton export

Hi,

We are trying to export a frame-by-frame animation instead of a skeletal animation.
The problem is that when we export as images, we get the atlas file and the spritesheets but not the skeleton data. Therefore we can't use it in Unity as the SkeletonAnimation or SkeletonRenderer require a skeleton data asset.

Did we miss something ?
Thanks for your help!

Related Discussions
...

SkeletonAnimation and SkeletonRenderer, as the name implies, require a skeleton. If you provide image sequences, then there is no skeleton information that these components (or the SkeletonDataAsset) can work with. You would then need to use a (non-Spine) Unity component that can handle image sequence animations.

In general it is not recommended to use image sequences instead of skeletons. What are your reasons that you want to use them instead?

Hi Harald, thanks for your reply!

We are looking for a frame by frame export and runtime for two reasons :

  • The main reason is that we need the objects to be transparent, but with the skeleton based rendering, all body parts are transparent on top of each others instead of having the whole body transparent with a frame by frame method (see attachment, notice how the head and the body are overlapping)

  • The second reason is that we have a lot of object on screen which impact the framerate and we would like to see if a frame by frame rendering would be a good optimization.

We tried all the different shaders provided in the spine package, but could not figure out a way to have the full body transparent instead of each parts separatly, do you know if this is achievable with a shader ?

Any other idea to solve that ?

Thanks a lot!
Anthony

Thanks for detailed writeup, that explains your reasons very well!

anthonyk wrote

We tried all the different shaders provided in the spine package, but could not figure out a way to have the full body transparent instead of each parts separatly, do you know if this is achievable with a shader ?

Unfortunately having overlapping attachments and making them all semi-transparent with no parts showing through is a principal rendering problem. There are two solutions with different drawbacks to this problem, as described in these forum threads:
Help plz! How do I make my character translucent in Unity?
Unity3D 에서 불투명한 스파인 리소스가 겹치는 문제 (the English parts)

There is also an issue ticket related to fadeout of skeletons here, in case it helps by providing additional ideas (it lists the same forum threads): https://github.com/EsotericSoftware/spine-runtimes/issues/1337

In short:

  • a) You could use shader that writes to the depth buffer (z buffer), called Write to Depth in Spine shaders. This will however make the outline a bit jaggy.
  • b) Render the skeleton to a RenderTexture with 100% opacity and then render this RenderTexture to the scene at your desired opacity. Performance-wise this is costly.
5 dana kasnije

Thank you Harald !
For characters where we are controlling the bones by code, we will work on a special shader as suggested.
For the other ones, we tried to export as frame by frame animation, and then make a new spine project using these frames and re-export as bytes. That way we end up with a frame by frame animation with skeleton data to use in unity, and we don't have the overlap problem anymore. Cherry on the cake, the performance gain is about x8 !

note :It would be great to have the option to export a frame by frame animation with skeleton data, without having to create a second project.
Thanks for your help!!

You're welcome!