Papapishu

Hello everyone!

As a team we are thinking it might be a better option for our project to move away from the Unity 2D Animation package to Spine both for performance and quality concerns. However, I am having difficulty with a very specific problem which wasn't an issue before.

Here is the sorting/masking issue I am having with Spine:
unity-spine-masking-problem.png

On the left you can see our old setup where characters are sorted and masked both among each other and with the table and chair parts. On the right is the same character imported with Spine. The character can only interact with masks as if it's one piece so the whole character is either in front or behind the tabletop and other parts.

The reason that the table and parts are not inside the Spine rig itself is because the type of tables and characters change dynamically during runtime in our game. Different types of tables are sometime half empty or full with different characters sitting in them randomly. I would also like to use these character in other objects where this type of layering might not be necessary, so exporting characters with premade clipping is also not the best option for me.

If you know how to mask or change the order of specific Spine bones/slots after importing to unity I would love to know. Or if you have other suggestions in order to solve this issue please let me know.

Thanks a bunch in advance!
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
Avatar
Papapishu
  • Postovi: 2

Jamez0r

Hey Papapishu,

You can separate a SkeletonAnimation into separately rendered sections, where each section can then have its own layering (Sorting Layer + Order In Layer). Check out the SkeletonRenderSeparator: spine-unity Runtime Documentation: SkeletonRenderSeparator (there is an Example included in the unity runtime for this if you want to check that out). Essentially what you are doing is using a Slot in Spine to act as a 'separation point' where the slots above it are rendered into one "Parts Renderer", and the slots below it are rendered into another "Parts Renderer". And you can use multiple 'separator slots' to break up the skeleton into as many pieces as you need. Then you can apply your layering to the individual Parts Renderers as needed to make it look correct.

Using the Render Separator, I think you should be able to do whatever you need to do without using Masking at all - but if you do need to still use Masking, there might be a way to apply individual "Masking" to a Parts Renderer by applying a Material that has the "Stencil" values set. I haven't tried this before though, so there might be a chance that the SkeletonAnimation component overrides the values that you set in the Material. spine-unity Runtime Documentation: Writing your own shaders
Avatar
Jamez0r
  • Postovi: 356

Harald

Thanks again for answering so many questions on the forum @Jamez0r, very much appreciated! 8)
Avatar
Harald

Harri
  • Postovi: 3992

Jamez0r

Harald je napisao/la:Thanks again for answering so many questions on the forum @Jamez0r, very much appreciated! 8)
:yes: 8)
Avatar
Jamez0r
  • Postovi: 356

Papapishu

Thank you very much for your answer Jamez0r!

I must of skipped the part about the 'Parts Renderer' when initially breezing through the Unity Runtime documentation. It makes perfect sense and works perfectly now. Like you said masking is probably not needed for my case so I will try to ditch it and find a solution by changing sorting order of different body parts on runtime.
Avatar
Papapishu
  • Postovi: 2


Natrag na Unity