History

   The Mandelbrot set is the definitive fractal. So it is no surprise that one would contemplate its 3D anolog. This is exactly what Daniel White was determined to find in late 2007; in his search for the "Holy Grail" of fractals. White was inspired by Rudy Rucker's early description in "As Above, So Below", published 1987, as "a root - like object that's like a big sphere with a dimple in the bottom and with bulbs on it, and further warts on the bulbs." So began White's earliest attempts to render such a fractal along with his success. However, there was one major complication, and it has to do with how the 2D version is defined. Mandelbrot's function operates on complex numbers and so it is only defined in ℝ2. What is one to do in order to obtain this ellusive bulb? We will explore this later.

The world will freely offer itself to you to be unmasked, it has no choice, it will roll in ecstasy at your feet.

Franz Kafka
8th order


controls

How to use

    This application has control panels for manipulating both the Mandelbulb formula and the rendering engine. Together these controls can produce a variety of interesting scenes in real time.

Mandelbulb Controls
  • Order: Changes the complexity by altering the power on the function.
  • Depth: Changes the detail by altering iteration depth of the function.
  • Rotation: Orients about the object's axes.
Render Controls
  • Fineness: Changes the detail by altering the minimum distance to surface.
  • Zoom: Changes the focal length of pinhole camera.
  • Eye: Translates the camera in world space.

How it works

Mandelbulb Formula

    As mentioned briefly above there is no clear 3D analog for the 2D Mandelbrot set. This has purely to do with the way complex numbers are defined. A complex has only two components and a specific algebra for multiplying two of them together. One could define a third component, but then would have to invent some algebra for multiplying these three component numbers. Let us call them "triplex."

    Multiplying triplex is important because the Mandelbrot function requires a triplex to be squared. One could define this multiplication similar to the way it is defined for the two component complex, but the result is vaguely Quarternion. One could even use a the Quarternion approach to extend the complex number into the 4th dimenstion, but these renderings do not produce the warty structure Rucker first embossed in our minds.

    The solution to this problem is a bit of a hack. It is simple, clever and produces the features desired for a 3D Mandelbrot set. It involves converting from a cartesian coordinate system into a polar one, and then performing complex mulitplication using rotations. Let us see this method first applied on a two component complex number.

let
c = (x, y)
then
c' = (r, Θ)
finally
|c2| = |c'2| = (r2, 2Θ)
    This arithmetic is sound for multiplying complex numbers in polar form. However, what is done next is not. The hack is now to perform this same method on a triplex by representing it in spherical form.
let
t = (x, y, z)
then
t' = (r, Θ, Φ)
and
|t2| = |t'2| = (r2, 2Θ, 2Φ)
finally
|tn| = |t'n| = (rn, nΘ, nΦ)
    The Mandelbrot function now has leverage on the third dimension and one can perform the necessary triplex multiplication. Notice how 'n' was used to generalize the power on the triplex. This is known as the "order" of the Mandelbulb. After White had used this technique to render he was still scartching his head over the lack of complexity. It was not until a mathematician, Paul Nylander, suggested "raising the power" on the function in order to increase the complexity of the fractal. It worked like a charm and hence the generalized form. This is all summed up by the following formula known as "White and Nylander's nth Power."
let
s = some triplex in ℝ3
and
u = (r, Θ, Φ)
then
Z(u)i = Z(u)ni-1 + v

high order

top

Rendering

    The goal of this project was to produce an interactive Mandelbulb using ray casting; which it does by using a handy performance tweak known as distance estimation. Conceptually, plain ray casting is done by marching a ray some constant amount from an origin in the direction of a target surface. The surface is then intersected by this ray and gives us a point in space. Ray casting is simple enough, but marching a constant amount can be slow, so it must be sped up with distance estimation. Note that ray casting is also known as "sphere tracing", becasue it is helpul to think of the amount marched as the radius of a sphere, this will become more apparent when distance estimation is discussed.

    It is important to note that this application only ever defines two trianges; so x-y coordinates are interpolated across the vertex-fragment interface. Meaning that all rendering is done on the GPU and this allows the application to exploit its massively parallelized architecture. Specifically, rendering is done in the fragment shader and this is where the raycast engine is specified. Describing exactly how to set up a raycaster is beyond the scope of this paper and so we will only discuss the topic conceptually from now on. But in a nutshell, the fragment shader must define a ray from a camera and this unique x-y pair, then compute an appropriate z value by marching this ray to an implicit surface defined by some formula, i.e. White and Nylander's nth Power. See John C. Hart (1994) Sphere Tracing: A Geometric Method for the Antialiased Ray Tracing of Implicit Surfaces.

    The real time nature of this application is due to distance estimation. Distance estimators are just functions that return a safe distance for the ray to march without hitting the surface. So instead of moving in small constant steps, it can move large distances along the ray with guarantee of not hitting the surface until some minimum distance is reached; upon which the ray caster bails out. Back to the sphere analogy, one can visualize this procedure as a sequence of spheres with decreasing radii to the surface. The smallest sphere is then the minimum distance specified for the raycaster to bail out on. This minimum distance is important in terms of the Mandelbulb because it defines a level of detail in the fractal surface: smaller spheres are able to cut deeper into the fractal and produce more complexity.

    John C. Hart did work with distance estimated 3D fractals back in 1989 Ray Tracing Deterministic 3-D Fractals. Specifically he used distance estimators to render 3D Julia sets using Quarternions. Using this paper one could find a way to create a distance estimator for the Mandelbulb function defined above. Hint: use the chain rule.

let
Z(u)i = Z(u)ni-1 + v
then
Z'(u)i = nZ(u)n-1i-1 * Z'(u)ni-1 + 1
finally
DE = 1/2 * |Z(u)| / |Z'(u)| * log(|Z(u)|)
    There are many ways to create distance estimators, but this method presented by Hart is good enough to approximate the surface. It is important to realize that ray casting in general works by revelaing the surface through solving equations and not sampling data sets. The scene is mathematically defined, and without this, real time would be impossible.