- Home /
ZTest in shader
I tried googling about it, but I can't find anything. I'm making a 2D game in one single plane, so I do not know what to set this to. I understand that it controls what to draw but not how and what the different settings do! I'd want to maximize performance, but I do not want to do that if I don't understand how it is working. :)
Anyone could give me clarification or link me to an explanation on the different settings?
If you're making a 2D game with sprites, the sprite renderer has an order and sorting layer setting that controls the depth, so if you're not using custom shaders for special alpha effects ZTest shouldn't be relevant. As far as i know it only aids in sorting transparent 'blended' (not clipped) faces, so you'll usually want to have it set to LEqual (if i remember correctly)
I am making custom shaders and what I am looking for is a description for each setting for ZTest. I'm pretty sure that ZTest is handling the sorting that the GPU does, so basically it should be able to overwrite the sorting layer/sorting order if set.
What I am looking for is a technical description/explanation of ZTest, i.e. how the algorithms work and if they are GPU or CPU side.