-
Notifications
You must be signed in to change notification settings - Fork 13
/
postDistortion.shader
52 lines (47 loc) · 1.25 KB
/
postDistortion.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Shader "LX/postDistortion"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_DistortionScale ("DistortionScale", float) = 0.1
_WaveLength ("WaveLength", float) = 1
_Offset ("Offset", float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"RenderType"="Opaque"
}
LOD 200
GrabPass
{
"_GrabTex"
}
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _GrabTex;
float4 _GrabTex_TexelSize;
float _DistortionScale;
float _WaveLength;
float _Offset;
struct Input
{
float4 screenPos;
};
fixed4 _Color;
void surf(Input IN, inout SurfaceOutputStandard o)
{
IN.screenPos.xy /= IN.screenPos.w;
IN.screenPos.y = -IN.screenPos.y + _Offset;
IN.screenPos.x += _DistortionScale * sin(_Time.y + IN.screenPos.y * _WaveLength)*0.01;
fixed4 c = tex2D(_GrabTex, IN.screenPos) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}