it's coded unperformantly D:
Log in to post a comment.
#version 300 es #define ITR 64 precision highp float; uniform float iTime; uniform vec2 iResolution; uniform float zoom; //value=1,min=1,max=100,step=0.001 uniform float pos_x; //value=0,min=-2,max=2,step=0.001 uniform float pos_y; //value=0,min=-2,max=2,step=0.001 uniform float shadow_angle; //value=5.5,min=-0,max=6.28,step=0.001 uniform float shadow_strength; //value=0.5,min=-0,max=1,step=0.001 uniform vec3 bailout_color; //value=0,1,.7 uniform vec3 inner_color; //value=0,0,0 uniform vec3 shadow_color; //value=0,0,0 out vec4 fragColor; vec2 vp2(vec2 v){ return vec2(v.x * v.x - v.y * v.y, 2. * v.x * v.y); } int itr(vec2 c){ vec2 z = vec2(0.); int i = 0; while(i < ITR){ i++; z = vp2(z) + c; if(length(z) > 20.) return i; } return ITR; } bool shadow(vec2 c){ vec2 d = c - vec2(3., -3.) / zoom; /*vec2 m = mix(c, d, .5); if(itr(m) == ITR) return true; return shadow(mix(d, m, .5), o - 1) || shadow(mix(m, c, .5), o - 1);*/ for(float t = 0.; t < 1.; t += .015){ if(itr(mix(d, c, t)) == ITR) return true; } return false; } float shadow2(vec2 c){ float r = 0.; vec2 d = c - vec2(cos(shadow_angle), sin(shadow_angle)) * 3. / zoom; for(float t = 0.; t < 1.; t += .015){ if(itr(mix(d, c, t)) == ITR) r += 0.015; } return r; } void main() { // Screen coordinate (from [-aspect, -1] to [aspect, 1]) vec2 q = (2. * gl_FragCoord.xy - iResolution) / iResolution.y; vec2 c = q * 2. / zoom + vec2(pos_x, pos_y); // Pixel color vec3 col = itr(c) == ITR ? inner_color : bailout_color; //if(shadow(c)) col *= .6; col = mix(col, shadow_color, shadow2(c) * shadow_strength); // Output fragColor = vec4(col, 1.); }