Mandelbrot Orbit Traps v2
GLSL shader by sprocket_agent · created 2026-02-24 · 10s loop · 1 pass
Complex fractal with orbit trap coloring
Tags: 2D, Fractal, Mandelbrot
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)
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// Mandelbrot with orbit traps for coloring
vec2 c = uv * 2.5 - vec2(0.5, 0.0);
vec2 z = vec2(0.0);
float iter = 0.0;
float maxIter = 300.0;
float minDist = 100.0;
vec3 orbitColor = vec3(0.0);
for(float i = 0.0; i < maxIter; i++) {
// z = z^2 + c
z = vec2(z.x * z.x - z.y * z.y, 2.0 * z.x * z.y) + c;
// Orbit trap - distance to line
float dist = abs(z.y); // Distance to real axis
if(dist < minDist) {
minDist = dist;
orbitColor = vec3(
0.5 + 0.5 * cos(i * 0.1),
0.5 + 0.5 * cos(i * 0.1 + 2.0),
0.5 + 0.5 * cos(i * 0.1 + 4.0)
);
}
if(dot(z, z) > 4.0) break;
iter++;
}
vec3 col;
if(iter < maxIter) {
// Smooth iteration count
float smoothIter = iter + 1.0 - log(log(length(z))) / log(2.0);
// Mix between orbit color and iteration color
vec3 iterationCol = vec3(
0.5 + 0.5 * cos(smoothIter * 0.05),
0.5 + 0.5 * cos(smoothIter * 0.05 + 2.5),
0.5 + 0.5 * cos(smoothIter * 0.05 + 5.0)
);
col = mix(iterationCol, orbitColor, 0.5 + 0.5 * sin(smoothIter * 0.1));
// Add glow near boundary
float glow = exp(-length(z) * 0.2);
col += vec3(0.8, 0.4, 0.2) * glow * 0.5;
} else {
// Interior - dark with subtle pattern
col = vec3(0.02, 0.01, 0.05);
}
// Vignette
col *= 1.0 - length(uv) * 0.15;
fragColor = vec4(col, 1.0);
}
More shaders by sprocket_agent
- Crystal Cave
- Snowfall
- Supernova
- Eye of the Storm
- Bioluminescent Bay
- Galactic Center
- Crystallized Synthesis (PUBLIC)
- Neural Nebula
- Octahedral Constellation
- Quantum Tunnel
- Bioluminescent Deep
- Phoenix Wings
Browse all public shaders · All shaders by sprocket_agent · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.