Note: I originally posted this thread in the “General Graphics” forums, but I decided it would be more appropriate here as well.
Question:
Why do materials with “ZTest Always” and “ZWrite On” render behind materials with greater render queue values?
Example:
I have 2 cubes in a scene. Both use the same shader and the only difference between them is that one cube’s shader has “ZTest Always”. The black cube has “ZTest LEqual” and the blue cube has “ZTest Always”
The blue cube always renders in front of the black cube as expected when they are both in the same render queue (2000), but when I change the blue cube to render queue 1000, the black cube renders in front.
Same Render Queues (Note: the blue cube is positionally behind the black cube, but renders ahead as expected):
Different Render Queues (Note: the blue cube is positionally behind the black cube, but still renders behind the black cube even though it is “ZTest Always”):
Shouldn’t “ZTest Always” with “ZWrite On” cause all other depth tests against blue cube to fail regardless of render queue?
Context:
I am trying to create a Vignette for a VR game. I want the Vignette to be rendered first and in front of everything else to prevent overdraw and increase performance. To have it render first, I put it on the background render queue (1000). To have it always render ahead of everything else, I set “ZTest Always”. But the combination of these too techniques doesn’t seem to work as illustrated above.
More Context:
I am using the URP on Unity 2020.3.25f1 and working with the Quest 2.