I’m trying to get a 2D water effect and found a shader that gives me the wavy effect I’m looking for. Unfortunately, I can’t seem to figure out how to add transparency to it. I am trying to emulate something like the water seen here:
I don’t need the dynamic waves at the top. I’m mainly just trying to apply this to a textured plane. I have looked through many similar posts about people trying to add transparency to certain shaders and have attempted to add several different lines to the wavy shader, but it seems like the answer is different depending on the type of shader you are using. Here is the shader I am trying to modify:
Shader "Custom/NewShader" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_SpeedX("SpeedX", float)=3.0
_SpeedY("SpeedY", float)=3.0
_Scale("Scale", range(0.005, 0.2))=0.03
_TileX("TileX", float)=5
_TileY("TileY", float)=5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
float4 uv_MainTex_ST;
float _SpeedX;
float _SpeedY;
float _Scale;
float _TileX;
float _TileY;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
float2 uv = IN.uv_MainTex;
uv.x += sin ((uv.x+uv.y)*_TileX+_Time.g *_SpeedX)*_Scale;
uv.x += cos (uv.y*_TileY+_Time.g *_SpeedY)*_Scale;
half4 c = tex2D (_MainTex, uv);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}