Shader "yum_food/fourier_water_display" { Properties { _MainTex ("FFT output", 2D) = "black" {} [IntRange] _Stage("Stage", Range(-1, 30)) = 0 [IntRange] _Num_Stages("Num stages", Range(1, 30)) = 0 [IntRange] _Direction("Direction", Range(0, 1)) = 0 } SubShader { Tags { "RenderType" = "Opaque" } Cull Off Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; sampler2D _MainTex; float4 _MainTex_TexelSize; int _Num_Stages; int _Stage; int _Direction; v2f vert(appdata_img v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); o.uv = v.texcoord; return o; } float4 frag(v2f i) : SV_Target { float4 c = tex2D(_MainTex, frac(i.uv + 0.5)); float total_stage = ((float) _Stage + _Direction * _Num_Stages) / (_Num_Stages * 2); c *= lerp(_MainTex_TexelSize.z, 1, total_stage); return float4(c.xyz, 1); } ENDCG } } }