Mandelbulb Introductions

The first time I came across a fractal I was looking at an IBM XT screen as a point moved across the screen one line at a time, slowly building up the 2d mandelbrot fractal. The complexity of the pattern was other-wordly, and the idea that my computer could just come up with this picture was pretty amazing to me. It took a while before I got around to building my own mandelbrot zoomer, but when I did, I was fascinated to find the amount of complexity that you could discover in a shape that originated from such a simple formula. Why do fractals show this infinite level of detail from such a simple set of mathetmatical instructions? What does that say about nature? About us?

Years went by, and I moved on to 3d graphics programming, working on sky simulations, level of detail rendering, special effects, etc. and those early experiments with fractals fell back into my memory. I moved on from computer games when I needed a proper job, but continued programming in my spare time for a number of years, this time focusing on non-realtime graphics.

After a number of years of messing around with raytracers I eventually started to explore distance estimators and sphere tracing, learning about how to create simple mathematical functions that can describe complex implicit structures, and then transform those structures into detailed 2d renders. And if you’ve taken a similar journey to me, it’s only a matter of time before you start to come across fractal objects.

The easier fractal objects to come up with are self-similar, and based on simple geometric rules, or on space folding and cutting. The mandelbulb though, is something quite different. I like to think of this type of fractal as an “emergent” fractal. The formula that generates it is simple, and the shape it generates is not predictable from the way the formula is created. The mandelbulb is really the successor to that earlier 2d fractal that I used to watch slowly building on my IBM XT, the mandelbrot.

Discovering the Mandelbulb

The discovery of the mandelbulb had occurred some years before I came across it, in the late 2000s. A guy called Daniel White became obsessed with an obscure branch of mathematics and computer graphics, and started out on the search to find a three dimensional emergent fractal, which exhibited some of the aspects of the mandelbrot.

At this point people had generated the following types of 3d fractals:

Quaternion 3d fractal (courtesy of Syntopia, click link for link!)

Daniel wasn’t particularly happy with these fractals, they had the appearance of “whipped cream” and didn’t show increasing detail as you zoomed into them. What Daniel was looking for was a formula that created infinite detail, that could be zoomed into repeatedly where you kept finding shadows of the original fractal at greater and greater zooms. And eventually he found what he was looking for.

The basic mathematics of the mandelbulb are very similar to the mandelbrot. You take a hypercomplex number of the form

z = θi + ϕj + k

You take this number, raise it to a power and add a constant.

zn+1 = zn8 + c

If those iterations tend towards infinity, then that point is outside the fractal, if they remain within the unit 2 sphere, then that point is inside the fractal. This time around we don’t colour points that are outside the fractal as we do in the mandelbulb.

And a magical fractal appears:

The mandelbulb fractal

If you’d like to read more about the journey that Daniel took to find these fractals, there’s a great writeup on his website at (https://www.skytopia.com/project/fractal/mandelbulb.html).

Rendering the Mandelbulb

To render this fractal people initially used 2d slices to get a sense of the compelxity that existed within the formula, and then stepped on from that to a voxel rendering system that evaluated the formula for stability at the centre of each voxel cell. This allowed satisfying initial results that allowed fractal enthusiasts to verify that there is indeed emergent complexity within this fractal structure.

Shortly after this a number of developers started to use a technical called raymarching with distance estimation to render these fractals in a far more efficient way. In fact, so efficient that they quickly reached a point where it was possible to do near-realtime exploration of these fractals. These days WebGL allows us to have true realtime rendering in the browser, and if you want to take a look, just click the image below to take a look at the viewer that I’ve but together.

There are a few things about these fractals that make them a convincing extension to the mandelbrot fractal. Firstly, there’s a truly infinite amount of detail within the fractal. If you zoom in you can see the same sort of shapes repeating with variations and additional similar detail all the way down to the limits of the floating point accuracy of your GPU (and much deeper if you abandon the realtime approaches).

Self-similarity within the mandelbulb

And if you change the formula to use a power of 2, instead of a power of 8, you’ll find the familiar mandelbrot fractal lying on the horizontal plane of the mandelbulb.

The 3d mandelbulb fractal, with a power of 2 instead of 8

When you get deeply into fractals you’ll find that there are surprising connections between different types of emergent fractal. The same kind of patterns keep popping up. One of the most unusual and surprising connections is that along the x-axis of the mandelbulb, you can find the logistic map, if you plot the values of sequential iterations on a single plot. And now that we’ve found the mandelbrot on the xy plane of the mandelbulb, we can assume that we will once again find the logistic map along the single axis of this three dimensional fractal.

The final interesting aspect of the mandelbulb, is that there are corresponding juliabulb fractals, in the same way that the mandelbrot fractal has corresponding julia sets. In this case the starting condition is based on the 3d coordinate of the fractal, but the constant used in the iteration is fixed at a 3d vector specified by the user. Here’s an example of the julia set using a starting coordinate of (0.6, 0.2, 0.7).

A Juliabulb fractal at (0.6, 0.2, 0.7)

Conclusion

Ultimately then, did this fully satisfy the fractal mathematicians that were seeking their 3d mandelbrot? Originally not so much, there was a feeling that the “whipped ice-cream” elements of the fractal should have more continuous detail:

Whipped cream detail inside the mandelbulb

In the mandelbrot fractal we don’t see these continuous elements on the edge of the mandelbrot set, as there’s continuous detail at every level of zoom. There’s also a sense that the variance of the zoomed in details isn’t quite as varied as the mandelbrot fractal. And there aren’t the lightning fork details that we see in the mandelbrot either.

Lightning forks at the extent of an area of the mandelbrot set

But for me, I’m satisfied that this is close enough. And with further advanacements in fractal graphics, particularly with hybrid fractals, this mandelbulb structure became instrumental in the explosion of interest in three dimensional fractals that kicked off ever since.

If you’d like to explore the fractal in more detail, please take some time to mess about with the mandelbulb viewer.

And keep an eye out for further articles where I’ll explore some of the further applications of this mathematics in generating beautiful 3d fractals.

Leave a Reply

Your email address will not be published. Required fields are marked *