Daniel Gray

Thoughts, Notes, Ideas, Projects

Contact

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 stunning organic, swirling forms with complex rotational symmetries that would be impossible in 2D.

Interactive Demo

Move your mouse to rotate the camera and control the Julia parameter. The fractal animates automatically, creating mesmerizing morphing patterns:

Mathematical Foundation

Quaternions

Quaternions extend complex numbers to 4D:

q=w+xi+yj+zkq = w + xi + yj + zk

Where i2=j2=k2=ijk=1i^2 = j^2 = k^2 = ijk = -1 and ij=kij = k, jk=ijk = i, ki=jki = j.

Quaternion Multiplication

vec4 qmul(vec4 q1, vec4 q2) {
    return vec4(
        q1.x * q2.x - q1.y * q2.y - q1.z * q2.z - q1.w * q2.w,
        q1.x * q2.y + q1.y * q2.x + q1.z * q2.w - q1.w * q2.z,
        q1.x * q2.z - q1.y * q2.w + q1.z * q2.x + q1.w * q2.y,
        q1.x * q2.w + q1.y * q2.z - q1.z * q2.y + q1.w * q2.x
    );
}

Quaternion Julia Iteration

The Julia set iteration in quaternion space:

zn+1=zn2+cz_{n+1} = z_n^2 + c

Where both zz and cc are quaternions. The quaternion square q2q^2 is computed using quaternion multiplication.

Distance Estimation

Similar to the Mandelbulb, we use:

dzlog(z)zd \approx \frac{|z| \cdot \log(|z|)}{|z'|}

Where $z'$ is the derivative of the iteration. For zn+1=zn2+cz_{n+1} = z_n^2 + c, the derivative is zn+1=2znznz'_{n+1} = 2z_n \cdot z'_n.

Visual Characteristics

Quaternion Julia sets exhibit:

  • Rotational symmetry: Complex 3D rotational patterns
  • Organic forms: Swirling, tentacle-like structures
  • Parameter sensitivity: Small changes in c create dramatically different shapes
  • 4D projection: The 3D slice reveals hidden 4D structure

Parameter Space

The Julia parameter c controls the shape:

  • Real components (c.x, c.y, c.z): Control the 3D structure
  • Imaginary component (c.w): Adds 4D rotation, creating more complex forms
  • Magnitude: Larger |c| creates more chaotic, fragmented structures

Applications

  • Digital art: Stunning abstract visualizations
  • Scientific visualization: Exploring 4D mathematical structures
  • Game assets: Procedural alien environments
  • Educational: Teaching quaternion algebra and 4D geometry

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 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...