Daniel Gray

Thoughts, Notes, Ideas, Projects

Contact

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):

dunion(p)=min(d1(p),d2(p))d_{\text{union}}(\mathbf{p}) = \min(d_1(\mathbf{p}), d_2(\mathbf{p}))

This creates a fractal that contains both structures.

Intersection Operation

The intersection (maximum distance):

dintersection(p)=max(d1(p),d2(p))d_{\text{intersection}}(\mathbf{p}) = \max(d_1(\mathbf{p}), d_2(\mathbf{p}))

Creates a fractal containing only the overlapping regions.

Smooth Minimum

A smooth minimum blends two fractals:

smin(a,b,k)=min(a,b)kmax(0,kab)2\text{smin}(a, b, k) = \min(a, b) - k \cdot \max(0, k - |a - b|)^2

Where kk controls the smoothness of the blend.

Subtraction Operation

Subtraction removes one fractal from another:

dsubtract(p)=max(d1(p),d2(p))d_{\text{subtract}}(\mathbf{p}) = \max(-d_1(\mathbf{p}), d_2(\mathbf{p}))

Blending

Linear blending mixes two fractals:

dblend(p)=(1t)d1(p)+td2(p)d_{\text{blend}}(\mathbf{p}) = (1 - t) \cdot d_1(\mathbf{p}) + t \cdot d_2(\mathbf{p})

Where t[0,1]t \in [0, 1] 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

Related Articles

Related Content

GLSL 3D Fractals - Mandelbulb

GLSL 3D Fractals - Mandelbulb The Mandelbulb is the 3D extension of the classic Mandelbrot set, discovered by Daniel White and Paul Nylander in 2009. It creates stunning organic, bulbous structures wi...

GLSL 3D Fractals - Quaternion Julia Sets

GLSL 3D Fractals - Quaternion Julia Sets Quaternion Julia sets extend the classic 2D Julia sets into 4D space using quaternion algebra, then project them back into 3D for visualization. The result is ...

GLSL 3D Fractals Series

GLSL 3D Fractals Series 3D fractals represent some of the most visually stunning and mathematically fascinating objects in computer graphics. This series explores how to render these infinite structur...