- Home /
Water Transparency - Help with Shader!
I bought a water shader package from the assets store and I wanted to make the water transparent but I'm having no luck figuring it out.
Here's the script I have:
Shader "Water Flow/Water Diffuse" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_MainTexColor ("Diffuse", Color) = (1,1,1,0.5)
_MainTexMultiply ("Multiply", Range(0,5)) = 1.5
_MainTexMoveSpeedU ("U Move Speed", Range(-6,6)) = 0.5
_MainTexMoveSpeedV ("V Move Speed", Range(-6,6)) = 0.5
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
ZWrite Off
Alphatest Greater 0
Blend SrcAlpha OneMinusSrcAlpha
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _MainTexColor;
fixed _MainTexMultiply;
fixed _MainTexMoveSpeedU;
fixed _MainTexMoveSpeedV;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed2 MainTexMoveScrolledUV = IN.uv_MainTex;
fixed MainTexMoveU = _MainTexMoveSpeedU * _Time;
fixed MainTexMoveV = _MainTexMoveSpeedV * _Time;
MainTexMoveScrolledUV += fixed2(MainTexMoveU, MainTexMoveV);
half4 c = tex2D (_MainTex, MainTexMoveScrolledUV);
o.Albedo = c.rgb * _MainTexColor * _MainTexMultiply;
o.Alpha = _MainTexColor.a;
}
ENDCG
}
FallBack "Diffuse"
}
Please let me know if something needs fixing, because I can't figure it out.
Comment
Best Answer
Answer by tanoshimi · Jul 12, 2015 at 09:44 PM
Try changing:
#pragma surface surf Lambert
to:
#pragma surface surf Lambert alpha
That works, but it only makes it semi transparent, I can't make it go fully :S
I've changed some of the RGB values and it looks great now, thank you! :)
Your answer
Follow this Question
Related Questions
Water foam shader that works on planet water 2 Answers
Shader add vertex displacement 0 Answers
Magnification shader creating very pixelated image 1 Answer
change water4 fade distance 0 Answers