Skip to content

Commit 56cfec1

Browse files
Drunk post-processing shader.
1 parent 190e9e7 commit 56cfec1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: drunk.shader

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Shader "Drunk"
2+
{
3+
Properties
4+
{
5+
_MainTex ("Texture", 2D) = "black" {}
6+
}
7+
Subshader
8+
{
9+
Pass
10+
{
11+
CGPROGRAM
12+
#pragma vertex vertex_shader
13+
#pragma fragment pixel_shader
14+
#pragma target 2.0
15+
16+
sampler2D _MainTex;
17+
18+
float4 vertex_shader (float4 vertex:POSITION):SV_POSITION
19+
{
20+
return mul(UNITY_MATRIX_MVP,vertex);
21+
}
22+
23+
float4 pixel_shader (float4 vertex:SV_POSITION):COLOR
24+
{
25+
vector <float,2> uv = vertex.xy/_ScreenParams.xy;
26+
uv.x+=cos(uv.y*2.0+_Time.g)*0.05;
27+
uv.y+=sin(uv.x*2.0+_Time.g)*0.05;
28+
float offset = sin(_Time.g *0.5) * 0.01;
29+
float4 a = tex2D(_MainTex,uv);
30+
float4 b = tex2D(_MainTex,uv-float2(sin(offset),0.0));
31+
float4 c = tex2D(_MainTex,uv+float2(sin(offset),0.0));
32+
float4 d = tex2D(_MainTex,uv-float2(0.0,sin(offset)));
33+
float4 e = tex2D(_MainTex,uv+float2(0.0,sin(offset)));
34+
return (a+b+c+d+e)/5.0;
35+
}
36+
ENDCG
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)