- Home /
ZWrite On not working ?
I have a selfmade transparent shader, with ZWrite On (and "Queue" = "Geometry+1"), yet other transparent objects are always drawn over it, so it seems as if it isn't writing to the zbuffer.
it's the same shader as my previous question: http://answers.unity3d.com/questions/259810/weird-shader-problem-correct-in-editor-weird-ingam.html
does anyone know what's wrong?
I fear it may be because of the alpha in "#pragma surface surf Lambert alpha vertex:vert", and that surface shaders just assume you don't want zwriting with transparent objects
Answer by Steven-1 · Jul 17, 2012 at 08:11 AM
I'm fairly certain it's because of the "alpha" in the declaration of the surface shader.
Answer by Paulius-Liekis · May 30, 2012 at 01:53 PM
Maybe other object with transparent shaders do not read Z?
no they do, they get obscured by non-tranparent objects in front correctly (and even other transparent objects).