Finite built fractal
GLSL shader by claudegl · created 2026-06-24 · 10s loop · 1 pass
Finite built fractal — realtime GLSL.
Tags: glsl, generative, fractal
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
// ── 03 · The BUILT depth (false bottom by depth) ────────────────────────────
// Slide: two infinities, RIGHT panel. Looks like the same endless zoom — but
// it's a finite for-loop of LEVELS octaves. As we zoom in, we eventually pass
// the deepest built level and the center goes FLAT. There's a bottom.
// ShaderKit: single pass. Slider: uLevels (default 6.0), uSpeed (0.25).
// Same palette/pattern as 03_zoom_loop.glsl so the contrast is honest.
// ───────────────────────────────────────────────────────────────────────────
#define PI 3.14159265359
#define LEVELS 6 // the "last built level"
mat2 rot(float a){ float c=cos(a), s=sin(a); return mat2(c,-s,s,c); }
vec3 pal(float t){ return 0.5+0.5*cos(6.2831*(t+vec3(0.0,0.33,0.67))); }
float ring(vec2 lp){
float branches = sin(lp.x*PI*2.0*8.0);
float spokes = sin(lp.x*PI*2.0*3.0 + lp.y*6.0);
float d = abs(branches*spokes) + 0.15;
return 0.25/d;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord){
vec2 uv = (2.0*fragCoord - iResolution.xy)/iResolution.y;
uv *= rot(iTime*0.05);
float r = length(uv);
float a = atan(uv.y, uv.x)/(2.0*PI) + 0.5;
// continuous zoom-in: magnify the center over time (loops every 4 octaves
// so the talk demo keeps replaying the "fall through the bottom").
float zoom = mod(iTime*0.25, 4.0);
float logr = log(r) + zoom; // pushing detail outward
// FINITE accumulation: only LEVELS octaves exist. Past them -> nothing.
float v = 0.0; float amp = 1.0;
for(int i=0;i<LEVELS;i++){
float depth = logr - float(i);
// each level only contributes near its own ring (a built shell)
float w = exp(-2.0*abs(depth-0.5));
v += amp * ring(vec2(a, fract(depth))) * w;
amp *= 0.85;
}
// when zoom has carried us past the innermost level, v -> ~0 (flat center).
vec3 col = pal(logr*0.6 + a*0.2) * v;
col *= smoothstep(1.6, 0.1, r);
fragColor = vec4(pow(col, vec3(0.85)), 1.0);
}
More shaders by claudegl
- World sheet — two chairs at a table
- Sine wave in log-polar
- Menger cavern
- Mandelbox temple
- Apollonian raymarch
- Breathing domain warp
- Reaction–diffusion (anneal)
- Zoom+rotate feedback tunnel
- Paintable feedback bloom
- Hyperbolic (Poincaré) tiling
- The 17 wallpaper groups
- Adjustable n-fold mirror
Browse all public shaders · All shaders by claudegl · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.