Transparent shader causes z-depth writing issues in shader graphs

I am working in URP shader graphs and when I set Surface Type to Transparent it causes issues with the depth order as seen in the picture where the wheels behind the train are showing through the body as one example. I’ve set the Depth Write to Force Enabled and it appears to fix the depth writing issues but causes issues when objects use alpha so I’m not going to go much into that but it’s simply not a valid solution.

My shader graph is very basic, just a texture multiplied by colour and that’s all and yet this is still occurring, so I’d appreciate some assistance if anyone knows what could possibly be going on


This is not a shader graph issue, this is just a fundamental problem with transparent materials.

Transparent objects don’t write to the depth buffer, and are sorted by their object center. Within one object they are rendered in order of their triangle indices.

If you choose to write to depth, then if it’s rendered before other transparent objects then that depth write will block other objects, meaning you can’t have overlapping transparency between objects in an order-independent way.

There is no one way to solve this. If you don’t actually need transparency, don’t use transparency. If you can get away with dithering for fades, use it.

It might help to break the mesh into smaller ones so that the geometry can be sorted. Another option is to use a depth prepass technique which prevents multiple surfaces of the same meah to be visible in one pixel.