PolyHeart

Hi,

I'm encountering an issue with trying to get Spine 2D to work with Visual Effects.

I use the URP Skeleton Lit shader for my models but it won't let me write to depth and therefore the visual effects always show up behind the models



I found that URP Sprite shader lets me write to depth so it works with visual effects' order correctly but creates these weird lines around the model



Is there a way to either use URP Skeleton Lit with write to depth or somehow remove the weird lines on the URP Sprite Shader?

Here is also the skeleton animation component if that helps
PolyHeart
  • Сообщения: 8

Harald

When having Write to Depth enabled you will need to increase the Depth alpha cutoff value as it's currently set to the very low value of 0.001. Semi-transparency combined with depth-write will however always be a tradeoff between cutting off too much (higher Depth alpha cutoff) and cutting off too little (your current state, low Depth alpha cutoff value) while still setting the depth value with a semi-transparent pixel which mostly shows the darker background and blocks subsequent overlaid pixels.

A slighly better solution would be to additionally allow a parameter to invert the draw order (from "front to back" to "back to front") in the MeshGenerator class for this skeleton. Unfortunately this requires some modifications to the spine-unity source code. If you really want to go down that road, a forum thread describing necessary code changes can be found here (also including English translation):
Unity3D 에서 불투명한 스파인 리소스가 겹치는 문제
Nevertheless this solves the problem only within a single skeleton, not when multiple transparent ones are overlaid in a scene. This is unfortunately a general problem with how the Z-buffer works.
Аватара пользователя
Harald

Harri
  • Сообщения: 4107


Вернуться в Unity