attribute vec3 inPosition; void main() { gl_Position = vec4(inPosition, 1.0); } precision highp float; uniform vec2 resolution; uniform float zoom; uniform vec2 offset; void main() { vec2 uv = (gl_FragCoord.xy/resolution * vec2(4,4) - vec2(2,2))/zoom + offset; uv.y *= resolution.y/resolution.x; vec2 z = vec2(0); int ai; for (int i = 0; i < 200; i++) { ai = i; z = vec2(z.x*z.x - z.y*z.y, 2.0*z.x*z.y) + uv; if (length(z) >= 2.0) break; } gl_FragColor = vec4(vec3(1. + 1./log(float(ai)/200.)), 1); }