Back to Explorer

The Architecture of Infinite Zoom

How I built a WebGL Mandelbrot explorer capable of bypassing JavaScript's native precision limits to achieve deep zooming using Perturbation Theory.


The Precision Problem

Standard 32-bit and 64-bit floating-point numbers break down extremely quickly when zooming into the Mandelbrot set. In a typical GLSL fragment shader, pixels use highp float (IEEE 754 single-precision, 32-bit). Around a zoom level of 104, coordinates lose precision, and the beautiful fractal turns into a blocky, pixelated staircase.

To push past this, we need higher precision. But GPUs don't natively handle arbitrary-precision math efficiently.

Float64 Emulation in GLSL

For intermediate zooms (up to 1014), I implemented a simulated double-precision (df64) architecture directly in the WebGL fragment shader. By representing a single 64-bit float as two 32-bit floats—a high part and a low part—we can perform complex arithmetic with significantly higher precision without leaving the GPU.

Perturbation Theory (The Infinite Zoom)

Float64 emulation only gets us to 1014. To go infinitely deep, we use a mathematical technique called Perturbation Theory.

Instead of calculating every pixel from scratch, we use the CPU (via the decimal.js library) to calculate an incredibly precise Reference Orbit at the very center of the screen. This reference orbit is computed using arbitrary precision math, which is slow but highly accurate.

We then upload this reference orbit to the GPU as a Data Texture. The GPU shader no longer calculates the absolute position of every pixel; instead, it only calculates the difference (the delta) between the pixel and the reference orbit. Because the difference is extremely small, standard 32-bit floats are perfectly fine to calculate it!

The Coloring Algorithm

The signature look of the fractal comes from an escape-time algorithm with smooth fractional coloring. Instead of banding colors based strictly on the integer iteration count where the orbit escaped, we use a continuous formula to interpolate smoothly between the core and aura palettes, producing those vivid, electric gradients.

Ready to explore?

Dive into the fractal and test the Perturbation Theory rendering yourself.

Launch Explorer