Debian Codegraph @

Shaders/cloud-shadowfunc.frag

raw
1 #version 120
2 uniform float cloudpos1_x;
3 uniform float cloudpos1_y;
4 uniform float cloudpos2_x;
5 uniform float cloudpos2_y;
6 uniform float cloudpos3_x;
7 uniform float cloudpos3_y;
8 uniform float cloudpos4_x;
9 uniform float cloudpos4_y;
10 uniform float cloudpos5_x;
11 uniform float cloudpos5_y;
12 uniform float cloudpos6_x;
13 uniform float cloudpos6_y;
14 uniform float cloudpos7_x;
15 uniform float cloudpos7_y;
16 uniform float cloudpos8_x;
17 uniform float cloudpos8_y;
18 uniform float cloudpos9_x;
19 uniform float cloudpos9_y;
20 uniform float cloudpos10_x;
21 uniform float cloudpos10_y;
22 uniform float cloudpos11_x;
23 uniform float cloudpos11_y;
24 uniform float cloudpos12_x;
25 uniform float cloudpos12_y;
26 uniform float cloudpos13_x;
27 uniform float cloudpos13_y;
28 uniform float cloudpos14_x;
29 uniform float cloudpos14_y;
30 uniform float cloudpos15_x;
31 uniform float cloudpos15_y;
32 uniform float cloudpos16_x;
33 uniform float cloudpos16_y;
34 uniform float cloudpos17_x;
35 uniform float cloudpos17_y;
36 uniform float cloudpos18_x;
37 uniform float cloudpos18_y;
38 uniform float cloudpos19_x;
39 uniform float cloudpos19_y;
40 uniform float cloudpos20_x;
41 uniform float cloudpos20_y;
42
43 uniform float cloudpos_n_x;
44 uniform float cloudpos_n_y;
45
46 float shadow_func (in float x, in float y, in float noise, in float dist)
47 {
48
49 if (dist > 30000.0) {return 1.0;}
50
51 float width = fract((cloudpos1_x)) * 5000.0;
52 float strength = fract((cloudpos1_y));
53
54
55 float dlength = length( vec2 (x - cloudpos1_x, y - cloudpos1_y));
56 float shadeValue = strength * (1.0-smoothstep(width * 0.5, width, dlength));
57
58 dlength = length ( vec2 (x - cloudpos2_x, y - cloudpos2_y));
59 width = fract((cloudpos2_x)) * 5000.0; strength = fract((cloudpos2_y));
60 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
61
62 dlength = length ( vec2 (x - cloudpos3_x, y - cloudpos3_y));
63 width = fract((cloudpos3_x)) * 5000.0; strength = fract((cloudpos3_y));
64 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
65
66 dlength = length ( vec2 (x - cloudpos4_x, y - cloudpos4_y));
67 width = fract((cloudpos4_x)) * 5000.0; strength = fract((cloudpos4_y));
68 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
69
70 dlength = length ( vec2 (x - cloudpos5_x, y - cloudpos5_y));
71 width = fract((cloudpos5_x)) * 5000.0; strength = fract((cloudpos5_y));
72 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
73
74 dlength = length ( vec2 (x - cloudpos6_x, y - cloudpos6_y));
75 width = fract((cloudpos6_x)) * 5000.0; strength = fract((cloudpos6_y));
76 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
77
78 dlength = length ( vec2 (x - cloudpos7_x, y - cloudpos7_y));
79 width = fract((cloudpos7_x)) * 5000.0; strength = fract((cloudpos7_y));
80 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
81
82 dlength = length ( vec2 (x - cloudpos8_x, y - cloudpos8_y));
83 width = fract((cloudpos8_x)) * 5000.0; strength = fract((cloudpos8_y));
84 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
85
86 dlength = length ( vec2 (x - cloudpos9_x, y - cloudpos9_y));
87 width = fract((cloudpos9_x)) * 5000.0; strength = fract((cloudpos9_y));
88 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
89
90 dlength = length ( vec2 (x - cloudpos10_x, y - cloudpos10_y));
91 width = fract((cloudpos10_x)) * 5000.0; strength = fract((cloudpos10_y));
92 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
93
94 dlength = length ( vec2 (x - cloudpos11_x, y - cloudpos11_y));
95 width = fract((cloudpos11_x)) * 5000.0; strength = fract((cloudpos11_y));
96 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
97
98 dlength = length ( vec2 (x - cloudpos12_x, y - cloudpos12_y));
99 width = fract((cloudpos12_x)) * 5000.0; strength = fract((cloudpos12_y));
100 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
101
102 dlength = length ( vec2 (x - cloudpos13_x, y - cloudpos13_y));
103 width = fract((cloudpos13_x)) * 5000.0; strength = fract((cloudpos13_y));
104 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
105
106 dlength = length ( vec2 (x - cloudpos14_x, y - cloudpos14_y));
107 width = fract((cloudpos14_x)) * 5000.0; strength = fract((cloudpos14_y));
108 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
109
110 dlength = length ( vec2 (x - cloudpos15_x, y - cloudpos15_y));
111 width = fract((cloudpos15_x)) * 5000.0; strength = fract((cloudpos15_y));
112 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
113
114 dlength = length ( vec2 (x - cloudpos16_x, y - cloudpos16_y));
115 width = fract((cloudpos16_x)) * 5000.0; strength = fract((cloudpos16_y));
116 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
117
118 dlength = length ( vec2 (x - cloudpos17_x, y - cloudpos17_y));
119 width = fract((cloudpos17_x)) * 5000.0; strength = fract((cloudpos17_y));
120 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
121
122 dlength = length ( vec2 (x - cloudpos18_x, y - cloudpos18_y));
123 width = fract((cloudpos18_x)) * 5000.0; strength = fract((cloudpos18_y));
124 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
125
126 dlength = length ( vec2 (x - cloudpos19_x, y - cloudpos19_y));
127 width = fract((cloudpos19_x)) * 5000.0; strength = fract((cloudpos19_y));
128 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
129
130 dlength = length ( vec2 (x - cloudpos20_x, y - cloudpos20_y));
131 width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y));
132 shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
133
134 shadeValue = shadeValue * (0.8 + 2.0 * shadeValue * smoothstep(0.4,0.6,noise));
135 shadeValue = clamp(shadeValue,0.0,1.0);
136 shadeValue = shadeValue * (1.0 - smoothstep(15000.0, 30000.0,dist));
137
138 return 1.0 - shadeValue;
139
140 }
141
142
143 float shadow_func_nearest (in float x, in float y, in float noise, in float dist)
144 {
145
146 if (dist > 6000.0) {return 1.0;}
147
148 float width = fract((cloudpos_n_x)) * 5000.0;
149 float strength = fract((cloudpos_n_y));
150
151
152 float dlength = length( vec2 (x - cloudpos_n_x, y - cloudpos_n_y));
153 float shadeValue = strength * (1.0-smoothstep(width * 0.5, width, dlength));
154
155 return 1.0 - shadeValue;
156 }