-
Notifications
You must be signed in to change notification settings - Fork 15
/
simplicity.sksl
32 lines (29 loc) · 1.07 KB
/
simplicity.sksl
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
uniform float2 iResolution;
uniform float iTime;
// Original https://www.shadertoy.com/view/lslGWr
// Simplicity by JoshP
// http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/
float field(in vec3 p) {
float strength = 7. + .03 * log(1.e-6 + fract(sin(iTime) * 4373.11));
float accum = 0.;
float prev = 0.;
float tw = 0.;
for (int i = 0; i < 32; ++i) {
float mag = dot(p, p);
p = abs(p) / mag + vec3(-.5, -.4, -1.5);
float w = exp(-float(i) / 7.);
accum += w * exp(-strength * pow(abs(mag - prev), 2.3));
tw += w;
prev = mag;
}
return max(0., 5. * accum / tw - .7);
}
vec4 main( vec2 fragCoord ) {
vec2 uv = 2. * fragCoord.xy / iResolution.xy - 1.;
vec2 uvs = uv * iResolution.xy / max(iResolution.x, iResolution.y);
vec3 p = vec3(uvs / 4., 0) + vec3(1., -1.3, 0.);
p += .2 * vec3(sin(iTime / 16.), sin(iTime / 12.), sin(iTime / 128.));
float t = field(p);
float v = (1. - exp((abs(uv.x) - 1.) * 6.)) * (1. - exp((abs(uv.y) - 1.) * 6.));
return vec4((mix(.4, 1., v) * vec3(1.8 * t * t * t, 1.4 * t * t, t)).rgb, 1);
}