• Runtimes
  • Unity Runtime: SkeletonComponent zSpacing

Got a question for the dev handling the Unity runtime (not sure who, hopefully they'll see this). I'm glad to see that Draw Order is now supported, but I notice that bones are still being sorted along the z-axis in 0.1 m increments. The draw order is still respected in Unity if I change SkeletonComponent.zSpacing to 0.0f, so I'm wondering if there is a specific reason why this property is set to 0.1f right now.

I need all of my bones to be on the same z-plane because I'm using a scale factor of 1024px per meter and a perspective camera, so these 0.1 m increments along the z-axis make a big difference. Manually setting zSpacing to 0.0f is fine for now, but I wanted to make sure this wasn't going to break anything down the road. 🙂

Related Discussions
...
  • Düzenlendi

I believe there were reports of z-fighting when using a perspective camera, so I set it to a relatively small value. I could set it to 0, what does everyone think?

I figured it was that. I get z-fighting with the cutout shader, but that's the only other one I've tried apart from the Spine shaders.

Yeah, I think the non-zero zSpacing is for other shaders.
It causes no problems at 0 with the basic Skeleton shader.

So I dunno about setting it to 0 by default. But I think it would benefit the majority.
0.1 amounts to a "10 pixel" distance towards the camera at default/recommended Unity settings. Although I'm not sure if 0.001 would still remedy z-fighting.