forked from przemyslawzaworski/Unity3D-CG-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccumulation.shader
More file actions
44 lines (38 loc) · 717 Bytes
/
accumulation.shader
File metadata and controls
44 lines (38 loc) · 717 Bytes
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
Shader "Accumulation"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
}
Subshader
{
Pass
{
CGPROGRAM
#pragma vertex vertex_shader
#pragma fragment pixel_shader
#pragma target 3.0
sampler2D _MainTex;
struct custom_type
{
float4 screen_vertex : SV_POSITION;
float2 uv: TEXCOORD0;
};
custom_type vertex_shader (float4 vertex:POSITION, float2 uv:TEXCOORD0)
{
custom_type vs;
vs.screen_vertex = mul (UNITY_MATRIX_MVP, vertex);
vs.uv=uv;
return vs;
}
float4 pixel_shader (custom_type ps ) : SV_TARGET
{
float2 uv = ps.uv.xy;
float4 c = tex2D(_MainTex,uv);
if (uv.x>0.5) c.x+=0.005;
return c;
}
ENDCG
}
}
}