123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- Shader "Custom/DoubleTransparent" {
- Properties{
- _MainTex("Main Text", 2D) = "white" {}
- [HDR]_Color ("Color Tint", Color) = (1, 1, 1, 1)
- _Magnitude ("Distortion Magnitude", Float) = 1
- _Frequency ("Distortion Frequency", Float) = 1
- _InvWaveLength ("Distortion Inverse Wave Length", Float) = 10
- _Speed ("Speed", Float) = 0.5
- _AlphaScale("AlphaScale",Range(0,1))=1
- }
- SubShader{
- Tags { "Queue" = "Transparent+1" "DisableBatching"="True"}
- Pass
- {
- Blend SrcAlpha OneMinusSrcAlpha
- Cull Off
- ZWrite Off
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- sampler2D _MainTex;
- float4 _MainTex_ST;
- fixed4 _Color;
- float _Magnitude;
- float _Frequency;
- float _InvWaveLength;
- float _Speed;
- float _AlphaScale;
- struct appdata
- {
- float4 vertex : POSITION;
-
- float4 texcoord : TEXCOORD0;
- };
- struct v2f
- {
- float4 pos : SV_POSITION;
- float2 uv: TEXCOORD1;
- };
- v2f vert(appdata v)
- {
- v2f o;
-
- float4 offset;
- offset.xzw = float3(0.0, 0.0, 0.0);
- offset.y = sin(_Frequency * _Time.y + v.vertex.x * _InvWaveLength + v.vertex.y * _InvWaveLength + v.vertex.z * _InvWaveLength) * _Magnitude;
- o.pos = UnityObjectToClipPos(v.vertex + offset);
-
- o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
- o.uv += float2(0.0, _Time.y * _Speed);
-
- return o;
- }
- float4 frag(v2f i) : SV_Target
- {
- fixed4 c = tex2D(_MainTex, i.uv);
- c.rgb *= _Color.rgb;
- c.a *=_AlphaScale;
-
- return c;
- }
- ENDCG
- }
- Pass {
- Tags { "LightMode" = "ShadowCaster" }
-
- CGPROGRAM
-
- #pragma vertex vert
- #pragma fragment frag
-
- #pragma multi_compile_shadowcaster
-
- #include "UnityCG.cginc"
-
- float _Magnitude;
- float _Frequency;
- float _InvWaveLength;
- float _Speed;
-
- struct v2f {
- V2F_SHADOW_CASTER;
- };
-
- v2f vert(appdata_base v) {
- v2f o;
-
- float4 offset;
- offset.xzw = float3(0.0, 0.0, 0.0);
- offset.y = sin(_Frequency * _Time.y + v.vertex.x * _InvWaveLength + v.vertex.y * _InvWaveLength + v.vertex.z * _InvWaveLength) * _Magnitude;
- v.vertex = v.vertex + offset;
- TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
-
- return o;
- }
-
- fixed4 frag(v2f i) : SV_Target {
- SHADOW_CASTER_FRAGMENT(i)
- }
- ENDCG
- }
- }
- }
|