Yes, Z-Spacing is not really a great option if you want to rotate the character around (typically you would scale a character to flip via e.g. skeleton.ScaleX = -1
). Using Z-Spacing with rotation, you would then need to set positive instead of negative Z-Spacing programmatically via script when facing away.
Nevertheless we would recommend to not use Write to Depth
and no Z-Spacing. Instead it would be advisable to fix the first issue instead, making the backside correctly lit. As mentioned, you can send us a minimal reproduction Unity project to have a look at what's going wrong.
Thanks for sending the reproduction package.
I just noticed that there were two problems on our side:
1) The URP/SkeletonLit shader not receiving shadows as the respective code is missing, now tracked under this issue ticker:
https://github.com/EsotericSoftware/spine-runtimes/issues/1840
2) The URP/Sprite shader disabling the "Receive Shadows" parameter when "Write to Depth" is disabled, although it would work without writing to the depth buffer. I have just published a fix for this second issue:
https://github.com/EsotericSoftware/spine-runtimes/issues/1839
A new 3.8 unitypackage is available for download where the "Receive Shadows" parameter can be enabled independently (note that the spine-unity core package needs to be updated, not the URP extension package).
So you might choose to switch to the Sprite shader now, or wait for the second bugfix.
You can find the updated 3.8 spine-unity unitypackage download here as usual:
Spine Unity Download
I will follow up here on the forum when the second issue has been resolved as well.
Thanks for reporting!
Answering your question received via email here on the forum so that others can benefit as well:
pizzamom đã viết
glad I could bring some attention to these! I'm trying the 3.8 package now and the lighting is working, although it's a similar issue to my original post where when flipped the shadow is cast on the sprite.
Is there something similar to the double-sided lighting feature used on the skeleton-lit shader?
Regarding URP/Sprite
shader and rotation:
It indeed seems that when Receive Shadows
is enabled and although fixed normal in screen space is provided, it casts a shadow on itself (perhaps shadow bias going in the wrong direction). When no normalmap is assigned, it seems that the backside is not lit at all.
It seems that not many are using the URP shaders with 180 degree rotation (instead of negative scale).
I have created a new issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1842
Thanks again for reporting!