Skip to content

Commit 436fe86

Browse files
committed
fix nested compositions for gl shaders
1 parent a238945 commit 436fe86

File tree

9 files changed

+5494
-93
lines changed

9 files changed

+5494
-93
lines changed

archive/creative-shader.txt

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
fsSource #version 300 es
2+
precision highp float;
3+
uniform float u_time;
4+
uniform float u_width;
5+
uniform float u_height;
6+
uniform float u_test;
7+
uniform float u_mouseX;
8+
uniform float u_mouseY;
9+
uniform float u_wheel;
10+
uniform float u_positionX;
11+
uniform float u_positionY;
12+
13+
uniform float value_1006af12a69e4b0794bb69e67d5552a5;
14+
uniform float value_6247f081d7ed46df9bd2b9dec2d97634;
15+
uniform float value_eb1d87be989d4667b517d4d784dd95c9;
16+
uniform float value_305d3627e9184fc3888824cfcc0debbc;
17+
uniform float value_62f9a833519c464fa032e91f2d063123;
18+
uniform float value_ea25f66467b844e4900a20302676d117;
19+
20+
21+
22+
23+
#define PI = 3.1415926535897932384626433832795;
24+
float metaball(vec2 p, vec2 center, float radius) {
25+
float r = radius * radius;
26+
float d = length(p - center);
27+
return r / (d * d);
28+
}
29+
30+
vec3 palete( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ){
31+
return a + b*cos( 6.28318*(c*t+d) );
32+
}
33+
34+
vec3 palete2(float t) {
35+
vec3 a = vec3(0.5, 0.5, 0.5);
36+
vec3 b = vec3(0.5, 0.5, 0.5);
37+
vec3 c = vec3(1.0, 1.0, 1.0);
38+
vec3 d = vec3(0.263,0.416,0.557);
39+
40+
return a + b*cos( 6.28318*(c*t+d) );
41+
}
42+
43+
vec3 chooseColor(float paleteOffset) {
44+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(2.0,1.0,0.0), vec3(0.5,0.20,0.25));
45+
}
46+
47+
vec3 chooseColor2(float paleteOffset) {
48+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.0,0.33,0.67));
49+
}
50+
51+
vec3 chooseColor3(float paleteOffset) {
52+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.0,0.1,0.2));
53+
}
54+
vec3 chooseColor4(float paleteOffset) {
55+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.3,0.2,0.2));
56+
}
57+
vec3 chooseColor5(float paleteOffset) {
58+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,0.5), vec3(0.8,0.9,0.3));
59+
}
60+
vec3 chooseColor6(float paleteOffset) {
61+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,0.7,0.4), vec3(0.0,0.15,0.2));
62+
}
63+
vec3 chooseColor7(float paleteOffset) {
64+
return palete(paleteOffset, vec3(0.8,0.5,0.4), vec3(0.2,0.4,0.2), vec3(2.0,1.0,1.0), vec3(0.0,0.25,0.25));
65+
}
66+
vec3 choosePalete(float paleteOffset , float paleteType) {
67+
if (paleteType == 1.0) {
68+
return chooseColor(paleteOffset);
69+
}
70+
if (paleteType == 2.0) {
71+
return chooseColor2(paleteOffset);
72+
}
73+
if (paleteType == 3.0) {
74+
return chooseColor3(paleteOffset);
75+
}
76+
if (paleteType == 4.0) {
77+
return chooseColor4(paleteOffset);
78+
}
79+
if (paleteType == 5.0) {
80+
return chooseColor5(paleteOffset);
81+
}
82+
if (paleteType == 6.0) {
83+
return chooseColor6(paleteOffset);
84+
}
85+
if (paleteType == 7.0) {
86+
return chooseColor7(paleteOffset);
87+
}
88+
return palete2(paleteOffset);
89+
90+
}
91+
vec2 rotate(vec2 v, float a) {
92+
float degreeToRad = a * 0.017453292519943295;
93+
return vec2(sin(degreeToRad) * v.x + cos(degreeToRad) * v.y, cos(degreeToRad) * v.x - sin(degreeToRad) * v.y);
94+
}
95+
96+
97+
out vec4 fragColor;
98+
void main() {
99+
100+
float aspect = u_width/u_height;
101+
vec2 resolution = vec2(u_width, u_height);
102+
vec2 uv = (gl_FragCoord.xy / resolution.xy);
103+
uv = uv * 2.0 - 1.0;
104+
uv.x *= aspect;
105+
106+
vec3 backgroundColor = vec3(0.0, 0.0, 0.0);
107+
vec3 finalColor = vec3(0.0);
108+
vec3 totalcolinf = vec3(0.00);
109+
float totalInfluence = 0.0;
110+
111+
112+
vec2 uvfract = rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117);
113+
vec3 color = vec3(0., 0., 0.);
114+
color += (choosePalete(((value_305d3627e9184fc3888824cfcc0debbc * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));color += (choosePalete(((value_eb1d87be989d4667b517d4d784dd95c9 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));color += (choosePalete(((value_1006af12a69e4b0794bb69e67d5552a5 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));
115+
backgroundColor = color;
116+
color += (choosePalete(((value_62f9a833519c464fa032e91f2d063123 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));
117+
118+
119+
float threshold = 1.5;
120+
float threshold2 = 13.5;
121+
if (totalInfluence > threshold) {
122+
vec3 color = (totalcolinf) / totalInfluence;
123+
if (totalInfluence < threshold2) {
124+
color = mix(backgroundColor, color, (totalInfluence - threshold) / (threshold2 - threshold));
125+
}
126+
fragColor = vec4(color, 1.0);
127+
} else {
128+
fragColor = vec4(backgroundColor, 1.0);
129+
}
130+
}
131+
132+
====================================================================================================
133+
134+
135+
136+
137+
138+
fsSource #version 300 es
139+
precision highp float;
140+
uniform float u_time;
141+
uniform float u_width;
142+
uniform float u_height;
143+
uniform float u_test;
144+
uniform float u_mouseX;
145+
uniform float u_mouseY;
146+
uniform float u_wheel;
147+
uniform float u_positionX;
148+
uniform float u_positionY;
149+
150+
uniform float value_1006af12a69e4b0794bb69e67d5552a5;
151+
uniform float value_6247f081d7ed46df9bd2b9dec2d97634;
152+
uniform float value_eb1d87be989d4667b517d4d784dd95c9;
153+
uniform float value_305d3627e9184fc3888824cfcc0debbc;
154+
uniform float value_62f9a833519c464fa032e91f2d063123;
155+
uniform float value_ea25f66467b844e4900a20302676d117;
156+
157+
158+
159+
160+
#define PI = 3.1415926535897932384626433832795;
161+
float metaball(vec2 p, vec2 center, float radius) {
162+
float r = radius * radius;
163+
float d = length(p - center);
164+
return r / (d * d);
165+
}
166+
167+
vec3 palete( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ){
168+
return a + b*cos( 6.28318*(c*t+d) );
169+
}
170+
171+
vec3 palete2(float t) {
172+
vec3 a = vec3(0.5, 0.5, 0.5);
173+
vec3 b = vec3(0.5, 0.5, 0.5);
174+
vec3 c = vec3(1.0, 1.0, 1.0);
175+
vec3 d = vec3(0.263,0.416,0.557);
176+
177+
return a + b*cos( 6.28318*(c*t+d) );
178+
}
179+
180+
vec3 chooseColor(float paleteOffset) {
181+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(2.0,1.0,0.0), vec3(0.5,0.20,0.25));
182+
}
183+
184+
vec3 chooseColor2(float paleteOffset) {
185+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.0,0.33,0.67));
186+
}
187+
188+
vec3 chooseColor3(float paleteOffset) {
189+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.0,0.1,0.2));
190+
}
191+
vec3 chooseColor4(float paleteOffset) {
192+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,1.0), vec3(0.3,0.2,0.2));
193+
}
194+
vec3 chooseColor5(float paleteOffset) {
195+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,1.0,0.5), vec3(0.8,0.9,0.3));
196+
}
197+
vec3 chooseColor6(float paleteOffset) {
198+
return palete(paleteOffset, vec3(0.5,0.5,0.5), vec3(0.5,0.5,0.5), vec3(1.0,0.7,0.4), vec3(0.0,0.15,0.2));
199+
}
200+
vec3 chooseColor7(float paleteOffset) {
201+
return palete(paleteOffset, vec3(0.8,0.5,0.4), vec3(0.2,0.4,0.2), vec3(2.0,1.0,1.0), vec3(0.0,0.25,0.25));
202+
}
203+
vec3 choosePalete(float paleteOffset , float paleteType) {
204+
if (paleteType == 1.0) {
205+
return chooseColor(paleteOffset);
206+
}
207+
if (paleteType == 2.0) {
208+
return chooseColor2(paleteOffset);
209+
}
210+
if (paleteType == 3.0) {
211+
return chooseColor3(paleteOffset);
212+
}
213+
if (paleteType == 4.0) {
214+
return chooseColor4(paleteOffset);
215+
}
216+
if (paleteType == 5.0) {
217+
return chooseColor5(paleteOffset);
218+
}
219+
if (paleteType == 6.0) {
220+
return chooseColor6(paleteOffset);
221+
}
222+
if (paleteType == 7.0) {
223+
return chooseColor7(paleteOffset);
224+
}
225+
return palete2(paleteOffset);
226+
227+
}
228+
vec2 rotate(vec2 v, float a) {
229+
float degreeToRad = a * 0.017453292519943295;
230+
return vec2(sin(degreeToRad) * v.x + cos(degreeToRad) * v.y, cos(degreeToRad) * v.x - sin(degreeToRad) * v.y);
231+
}
232+
233+
234+
out vec4 fragColor;
235+
void main() {
236+
237+
float aspect = u_width/u_height;
238+
vec2 resolution = vec2(u_width, u_height);
239+
vec2 uv = (gl_FragCoord.xy / resolution.xy);
240+
uv = uv * 2.0 - 1.0;
241+
uv.x *= aspect;
242+
243+
vec3 backgroundColor = vec3(0.0, 0.0, 0.0);
244+
vec3 finalColor = vec3(0.0);
245+
vec3 totalcolinf = vec3(0.00);
246+
float totalInfluence = 0.0;
247+
248+
249+
vec2 uvfract = rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117);
250+
vec3 color = vec3(0., 0., 0.);
251+
color += (choosePalete(((value_1006af12a69e4b0794bb69e67d5552a5 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));color += (choosePalete(((undefined * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));color += (choosePalete(((value_eb1d87be989d4667b517d4d784dd95c9 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));
252+
backgroundColor = color;
253+
color += (choosePalete(((value_62f9a833519c464fa032e91f2d063123 * 0.4) + ((u_time * 0.4) + length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117)))),value_6247f081d7ed46df9bd2b9dec2d97634) * pow((0.01 / abs(((sin(((8.0 * (exp((-(length(rotate((vec2(u_positionX, u_positionY) + uv) * u_wheel, value_ea25f66467b844e4900a20302676d117))))) * length((fract(uvfract * 1.5) + vec2(-0.5, -0.5))))) + (1.0 * u_time)) * 1.0 + 0.0) * 1.0) / 8.0))),1.2));uvfract = (fract(uvfract * 1.5) + vec2(-0.5, -0.5));
254+
255+
256+
float threshold = 1.5;
257+
float threshold2 = 13.5;
258+
if (totalInfluence > threshold) {
259+
vec3 color = (totalcolinf) / totalInfluence;
260+
if (totalInfluence < threshold2) {
261+
color = mix(backgroundColor, color, (totalInfluence - threshold) / (threshold2 - threshold));
262+
}
263+
fragColor = vec4(color, 1.0);
264+
} else {
265+
fragColor = vec4(backgroundColor, 1.0);
266+
}
267+
}

archive/mandelbrot-glsl.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
fsSource #version 300 es
2+
precision highp float;
3+
uniform float u_time;
4+
uniform float u_width;
5+
uniform float u_height;
6+
uniform float u_test;
7+
uniform float u_mouseX;
8+
uniform float u_mouseY;
9+
uniform float u_wheel;
10+
uniform float u_positionX;
11+
uniform float u_positionY;
12+
13+
uniform float value_5f3621270de84d5e87f043581d434940;
14+
uniform float value_a4ab03ce9f2942f1b9e486d740fcf497;
15+
uniform float value_12e5e70e35c04f9c98e4222db436d5fe;
16+
17+
18+
19+
20+
#define PI = 3.1415926535897932384626433832795;
21+
float metaball(vec2 p, vec2 center, float radius) {
22+
float r = radius * radius;
23+
float d = length(p - center);
24+
return r / (d * d);
25+
}
26+
27+
28+
29+
30+
out vec4 fragColor;
31+
void main() {
32+
33+
float aspect = u_width/u_height;
34+
vec2 resolution = vec2(u_width, u_height);
35+
vec2 uv = (gl_FragCoord.xy / resolution.xy);
36+
uv = uv * 2.0 - 1.0;
37+
uv.x *= aspect;
38+
39+
vec3 backgroundColor = vec3(0.0, 0.0, 0.0);
40+
vec3 finalColor = vec3(0.0);
41+
vec3 totalcolinf = vec3(0.00);
42+
float totalInfluence = 0.0;
43+
44+
45+
float iterations = 0.;
46+
vec2 c = (vec2(u_positionX, u_positionY) + uv) * u_wheel;
47+
vec2 z = vec2(0., 0.);
48+
for (float i1 = 0.; i1 < 1024.0; i1+=1.0) {
49+
z = vec2((((z.x * z.x) - (z.y * z.y)) + c.x), (c.y + ((z.x * 2.0) * z.y)));if ((dot(z,z) > value_12e5e70e35c04f9c98e4222db436d5fe)) {
50+
break;
51+
}iterations = i1 > 511.0 ? 0.0 : i1 - log2(log2(dot(z,z))) + 4.0;
52+
}
53+
backgroundColor = vec3(cos(((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940)), cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 0.6)), cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 1.0)));
54+
55+
56+
57+
float threshold = 1.5;
58+
float threshold2 = 13.5;
59+
if (totalInfluence > threshold) {
60+
vec3 color = (totalcolinf) / totalInfluence;
61+
if (totalInfluence < threshold2) {
62+
color = mix(backgroundColor, color, (totalInfluence - threshold) / (threshold2 - threshold));
63+
}
64+
fragColor = vec4(color, 1.0);
65+
} else {
66+
fragColor = vec4(backgroundColor, 1.0);
67+
}
68+
}
69+
70+
71+
72+
====================================================================================================
73+
74+
backgroundColor = vec3(
75+
cos(((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940)),
76+
cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 0.6)),
77+
cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 1.0))
78+
);
79+
80+
backgroundColor = vec3(
81+
((cos(((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940)) * 0.5) + 0.5),
82+
((cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 0.6)) * 0.5) + 0.5),
83+
((cos((((iterations * value_a4ab03ce9f2942f1b9e486d740fcf497) + value_5f3621270de84d5e87f043581d434940) + 1.0)) * 0.5) + 0.5));
84+

0 commit comments

Comments
 (0)