- Home /
How can I enable ZWrite on Transparent Shaders?
I am using a Transparent shader on a convex object. Obviously the zbuffer is not written, because the individual faces of the object overlap each other due to its convex shape, which is unintended in my case. The reason why I am using transparency in the first place, is to be able to fade out the object. Is there a better way to handle this in Unity?
If the shader is Transparent, it doesn't meand ZWrite is Always. you can add ZWrite Off in shader, or send shader code
Answer by Bunny83 · Jan 27, 2011 at 11:02 AM
Do you use an own shader or a builtin shader? All builtin transparent shaders don't do zwrite. In your own shader you can do:
ZWrite On
Take a look at ShaderLab
My guess is that you need backface culling which is off for most transparent shaders
Thank you, I was using the built-in shaders, so I need to do my own. Considering your guess: I do not need backface culling off, since my object in question is a regular 3d object being part of the GUI and it only uses transparency to fade out (thus rendering backfaces is not desirable).
Your answer
Follow this Question
Related Questions
How to change ZWrite in transparency shaders 0 Answers
ZWrite only for the object itself 0 Answers
ZWrite On not working ? 2 Answers
URP – Order Independent Transparency 0 Answers
My Transparency Shader Is No Longer Working on Mobile? 0 Answers