- Home /
Unlit Alpha Shader not working with Simple Water
I acquired this shader code from the UnityAnswers and it works great however, in all my searching and fiddling (I am terrible at shaders) I can not figure out a way to make the shader work properly with the Simple Water (standard assets) shader. If an object with this unlit/alpha shader is submerged in the simple water object, the unlit/alpha shader looks as if it is at a higher z priority and never appears to be under the water.
Here is the code I am using:
[code] Properties { _Color ("Main Color (A=Opacity)", Color) = (1,1,1,1) _MainTex ("Base (A=Opacity)", 2D) = "" }
Category { Tags {"Queue"="Transparent" "IgnoreProjector"="True"} ZWrite On Blend SrcAlpha OneMinusSrcAlpha
SubShader {Pass {
GLSLPROGRAM
varying mediump vec2 uv;
#ifdef VERTEX
uniform mediump vec4 _MainTex_ST;
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
uv = gl_MultiTexCoord0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
}
#endif
#ifdef FRAGMENT
uniform lowp sampler2D _MainTex;
uniform lowp vec4 _Color;
void main() {
gl_FragColor = texture2D(_MainTex, uv) * _Color;
}
#endif
ENDGLSL
}}
SubShader {Pass {
SetTexture[_MainTex] {Combine texture * constant ConstantColor[_Color]}
}}
} }
[/code]
Many thanks!
Comment