-
Notifications
You must be signed in to change notification settings - Fork 0
/
julia.glsl
59 lines (56 loc) · 2.09 KB
/
julia.glsl
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
uniform vec2 C0 = vec2(0, 0);
uniform float R = .1;
uniform float frequency = 0;
uniform float phase = 0;
uniform int maxIter = 256;
vec4 palette[] = {
vec4(0.2, 0.82827691, 0.73179388, 1),
vec4(0.33558099, 0.56276154, 0.31259016, 1),
vec4(0.43111904, 0.67818013, 0.41161102, 1),
vec4(0.03867438, 0.63622777, 0.32658885, 1),
vec4(0.48358546, 0.09638016, 0.67663664, 1),
vec4(0.485924, 0.23343763, 0.91809017, 1),
vec4(0.88796017, 0.61201257, 0.27339058, 1),
vec4(0.83882589, 0.64383644, 0.09622072, 1),
vec4(0.01327971, 0.82619565, 0.00997466, 1),
vec4(0.44003739, 0.64957503, 0.56506783, 1),
vec4(0.70291725, 0.354177, 0.88889361, 1),
vec4(0.10876201, 0.03116597, 0.4970506, 1),
vec4(0.21842718, 0.65107856, 0.77407211, 1),
vec4(0.62472369, 0.67351401, 0.54156339, 1),
vec4(0.52660062, 0.65478348, 0.6903755, 1),
vec4(0.887874, 0.70906976, 0.24454882, 1),
vec4(0.01400926, 0.289224, 0.25772643, 1),
vec4(0.62375722, 0.58030861, 0.73954609, 1),
vec4(0.49688711, 0.85774904, 0.94012755, 1),
vec4(0.24801657, 0.22962643, 0.01820842, 1),
vec4(0.46926831, 0.96136216, 0.93067244, 1),
vec4(0.15262276, 0.23523145, 0.92461766, 1),
vec4(0.67759149, 0.02473335, 0.98269969, 1),
vec4(0.22145518, 0.19967951, 0.84491543, 1),
vec4(0.82178284, 0.53650773, 0.21723608, 1),
vec4(0.63204306, 0.25339407, 0.92700783, 1),
vec4(0.22531261, 0.93938018, 0.78578655, 1),
vec4(0.27993015, 0.36284003, 0.05921213, 1),
vec4(0.37308418, 0.22205275, 0.81658374, 1),
vec4(0.95511581, 0.66688371, 0.57565343, 1),
vec4(0.15190167, 0.88294492, 0.62283619, 1),
vec4(0, 0, 0, 1),
};
vec2 f(vec2 z, vec2 C){
return vec2(z.x*z.x - z.y*z.y, 2*z.x*z.y) + C;
}
void main(){
int i = 0;
vec2 z = pos.xy*scale+offset.xy;
z.x *= res.x / res.y;
vec2 C = C0*C0*C0;
while(i++ < maxIter){
z = f(z, C + R*vec2(cos(frequency*time+phase), sin(frequency*time+phase)));
if(dot(z, z) > 4){
break;
}
}
int index = int(round(float(i)/float(maxIter) * 32));
frag0 = palette[index];
}