The depth mask shader from the wiki dosen’t work on the iPhone , it has no effect on the output (altough it does work inside the editor even in iPhone graphic emulation).
can anyone help me fix it?
Shader "DepthMask"
{
SubShader
{
// Turn off lighting, because it's expensive and the thing is supposed to be
// invisible anyway.
Lighting Off
// Draw into the depth buffer in the usual way. This is probably the default,
// but it doesn't hurt to be explicit.
ZTest LEqual
ZWrite On
// Don't draw the RGB colour channels, just the alpha channel. This means
// that nothing visible is drawn. Ideally, I would have liked to set ColorMask
// to draw nothing at all, but it doesn't seem to be possible to say anything
// like ColorMask None.
ColorMask A
// Do nothing specific in the pass:
Pass {}
}
}
The problem is that the Diffuse shader doesn’t work on the iPhone. (It falls back to the VertexLit shader.) So, I just cut and pasted some code from the VertexLit shader, and came up with this, which, when applied to the plane (water), works great!