GLSL 3D Fractals - Hybrid Fractals
Hybrid fractals combine multiple fractal formulas to create entirely new structures. By blending Mandelbulbs with Julia sets, mixing geometric and algebraic fractals, or applying creative operations, we can discover unique and beautiful forms that don't exist in nature or pure mathematics.
Interactive Demo
Move your mouse to rotate the camera and explore the hybrid fractal. Scroll to adjust blend parameters and see how different combinations create new structures:
Mathematical Foundation
Union Operation
The simplest hybrid operation is the union (minimum distance):
This creates a fractal that contains both structures.
Intersection Operation
The intersection (maximum distance):
Creates a fractal containing only the overlapping regions.
Smooth Minimum
A smooth minimum blends two fractals:
Where controls the smoothness of the blend.
Subtraction Operation
Subtraction removes one fractal from another:
Blending
Linear blending mixes two fractals:
Where is the blend factor.
Hybrid Patterns
Mandelbulb-Julia Hybrid
Combine Mandelbulb and Julia set iterations:
float hybridDE(vec3 pos, float blend) {
float d1 = mandelbulbDE(pos);
float d2 = juliaDE(pos);
return mix(d1, d2, blend);
}
Geometric-Algebraic Hybrid
Mix geometric (Menger Sponge) with algebraic (Mandelbulb):
float hybridDE(vec3 pos) {
float d1 = mengerSpongeDE(pos);
float d2 = mandelbulbDE(pos);
return smoothMin(d1, d2, 0.1);
}
Layered Fractals
Stack multiple fractals at different scales:
float layeredDE(vec3 pos) {
float d1 = fractalDE(pos);
float d2 = fractalDE(pos * 2.0) * 0.5;
float d3 = fractalDE(pos * 4.0) * 0.25;
return min(min(d1, d2), d3);
}
Modulated Fractals
Use one fractal to modulate another:
float modulatedDE(vec3 pos) {
float mod = fractal1DE(pos) * 0.1;
return fractal2DE(pos + mod);
}
Creative Techniques
Domain Warping
Warp space before computing the fractal:
vec3 warp(vec3 p) {
return p + 0.1 * sin(p * 5.0);
}
float warpedDE(vec3 pos) {
return fractalDE(warp(pos));
}
Rotation Blending
Rotate one fractal relative to another:
float rotatedHybridDE(vec3 pos, float angle) {
mat3 rot = rotationMatrix(angle);
float d1 = fractal1DE(pos);
float d2 = fractal2DE(rot * pos);
return smoothMin(d1, d2, 0.2);
}
Scale Variation
Vary scale across space:
float scaledHybridDE(vec3 pos) {
float scale = 1.0 + 0.3 * sin(length(pos) * 2.0);
return fractalDE(pos * scale) / scale;
}
Implementation Example
Complete Hybrid Shader
float hybridFractalDE(vec3 pos, float time) {
// Mandelbulb component
float d1 = mandelbulbDE(pos, 8.0);
// Julia component (rotated)
vec3 juliaPos = rotateY(pos, time * 0.1);
float d2 = quaternionJuliaDE(juliaPos, vec4(0.3, 0.3, 0.3, 0.1));
// Menger Sponge component (scaled)
vec3 mengerPos = pos * 1.5;
float d3 = mengerSpongeDE(mengerPos);
// Combine with smooth minimum
float d = smoothMin(d1, d2, 0.15);
d = smoothMin(d, d3, 0.1);
return d;
}
Visual Characteristics
Hybrid fractals exhibit:
- Unique forms: Structures that don't exist in pure fractals
- Complex beauty: Rich detail from multiple sources
- Artistic potential: Endless creative possibilities
- Infinite variety: Countless combinations to explore
Performance Considerations
Optimization
- Early termination: Stop when any component diverges
- Bounding spheres: Use union of bounding spheres
- Level of detail: Reduce iterations for distant objects
- Selective computation: Only compute needed components
Trade-offs
- More components: More detail, slower rendering
- Smooth blending: Better appearance, more computation
- Complex operations: More interesting, higher cost
References
- "Fractals: Form, Chance, and Dimension" by Benoit Mandelbrot
- Fractal Forums - Hybrid Fractals
- Inigo Quilez - Distance Functions
Related Articles
- Mandelbulb - One component of hybrids
- Quaternion Julia Sets - Another component
- Distance Estimation Methods - Techniques for combining
- GLSL 3D Fractals Series