Hi Everyone! I am using Alpha Vertex Lit Z shader that do exactly what i need. http://wiki.unity3d.com/index.php?title=AlphaVertexLitZ However, is it possible to have the same effect in a fragment shader ? Or is there a way to control vertex position in ShaderLab ? Any feedback on this would be great. Best regards.
Yes, that's possible. The same strategy of first filling the depth buffer can be applied. Yes, you can modify the vertex positions in the vextex shader.
Thanks mate i found how to do it. I just added ColorMask 0 to the fragmentation pass and then another pass with ColorMask RGB and that did the trick. Basically the content of The 2 passes i very identical except the Color Mask value and the Zwrite value. I am sure there is a smarter way of doing this but anyway it worked.
True, that pretty much is it. Technically you would also want to make your fragment shader very simple in the first pass, because the color is thrown away anyway. But, realistically, the GPU driver already does this for you.