Shader "Unlit/Wavy2" { Properties { _MainTex ("Texture", 2D) = "white" {} _Len ("Len", float) = 1 _Alpha ("Alpha", float) = 1.0 } SubShader { Tags { "Queue"="Transparent" } LOD 100 Cull Off Pass { Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag // #pragma cull off // make fog work #pragma multi_compile_fog #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; sampler2D _MainTex; float4 _MainTex_ST; float _Len; float _Alpha; v2f vert (appdata v) { v2f o; float4 vout = v.vertex; float angle = v.vertex.x * UNITY_PI * 2 * _Len; vout.x = sin(angle); vout.y = 1 - cos(angle); o.vertex = UnityObjectToClipPos(vout); o.uv = v.uv; UNITY_TRANSFER_FOG(o, o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { fixed4 col = tex2D(_MainTex, i.uv); col.a *= _Alpha; // apply transparency float speed = 2; float width = 0.01; float currentTime = _Time.y * speed; float lightPosition = fmod(currentTime, 1.0); float distanceToLight = abs(i.uv.x - lightPosition); if (distanceToLight < width) { float intensity = 0.5 * (1.5 - (distanceToLight / width)); col *= intensity; } else { col *= 0.2; } return col; } ENDCG } } }