-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathafrica_shader.shader
124 lines (50 loc) · 1.37 KB
/
africa_shader.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Shader "Unite-2019/shader"{
//properties
Properties{
_MainTexture("Hello this is my main texture",2D)="white"{}
_Color("Color",Color)=(1,1,1,1)
}
//subshaders
//platform specific shaders
Subshader{
//passes-drawcalls
Pass
{
//header inclusions
CGPROGRAM
#pragma vertex vertexfunction
#pragma fragment fragmentfunction
#include "UnityCG.cginc"
//appdata structure
struct appdata{
float4 position:POSITION;
float2 uv:TEXCOORD0;
float3 normal:NORMAL;
};
//preprocessor structure for passing the attributes to the fragment shader
struct v2f{
float4 position:SV_POSITION;
float2 uv:TEXCOORD0;
};
//variables
sampler2D _MainTexture;
float4 _Color;
//preprocess our vertex attributes to send to fragment shader
v2f vertexfunction(appdata IN)
{
v2f OUT;
//UNITY_MATRIX_MVP
OUT.position = UnityObjectToClipPos(IN.position);
OUT.uv=IN.uv;
return OUT;
}
//here comes the beautiful part
//fragment shader
fixed4 fragmentfunction(v2f i):SV_Target{
float4 color=tex2D(_MainTexture,i.uv)*_Color;
return color;
}
ENDCG
}
}
}