Friday 25 June 2010

A 3D Mandelbrot

Skytopia have a great set of pages on the search for a 3D version of the Mandelbrot Set. Or at least, for an interesting 3D version of the normal Mandelbrot.

It's easy enough to produce fractal solids that have a Mandelbrot on one plane, and if you plot the correct 3D shadows of the 4D Julia Set, you can find shapes that have Mandelbrots on multiple intersecting planes. But getting a Mandelbrot on two perpendicular intersecting planes, while having the transition between them being more interesting than simply spinning or rotating the thing on its axis, is more difficult.




The "normal" Mandelbrot has one "real" component and one "imaginary" component, set on the x and y axes. If you add another imaginary component on axis z, you simply get the sort of boring "spun" shape that you might produce on a lathe. If you distinguish the two "imaginary" axes by whapping a minus sign in front of one of them, you get a hybrid Mandebrot/Tricorn solid, but one of the cross-sections is then a tricorn rather than a 'brot.

From here, you can try hypercomplex numbers, number systems that support multiple distinct imaginary components and define how they should fit together. In a simple hypercomplex system, we have four components, r, i, j and k — “r” is real, i and j are identicallly-acting roots of minus one, but i-times-j gives a third creature, k, and k-squared gives plus one. So we can plot r, i, j to get a 3D Mandelbrot. Trouble is, as Skytopia point out, it's a bit boring … if we look down on the 'brot's side-bulbs, they show up as simple nubbins. There are other way to try to force Mandelbrot cross-sections, but they're a bit arbitrary, and the results tend to look like someone's cut them out of a block of wood using a Mandelbrot template.


Paul Nylander (bugman) then started looking at higher-powered counterparts of the Mandebrot, and realised that the boring hypercomplex solid for z^2 actually got pretty damned interesting when you jacked the power value up to eight (z^8). This gives a gorgeously intricate beast now referred to as a Mandelbulb, with bulbs that spawn bulbs all over the place. It also has Julia-set siblings. But it's not a standard Mandelbrot.


So what else? Well, the “standard” hypercomplex number system isn't the only option. There are alternative systems that give multiple imaginary components with slightly different interrelations. There are quaternions (tried them, didn't like them), and there are other potential configurations and a larger overarching system of eight-parameter octonions. The Mandelbrot-based solid at the top of this blog was made with one of those. The internal shape is also slightly reminiscent of a Buddhabrot.

The semitransparent voxel plot above isn't really able to show the shape properly, you can see there there's some fine floating ribs that connect some of the Mandelbrot features on the two planes that aren't being adequately captured by the plot, so I'll have to run off a larger version at some point, and perhaps experiment with some colour-coding. Some of the more exotic detail, like the floating network of ribbing, might also be an artefact of a technique I used to emphasise surface structure in the plot, so I'll need to spend some time playing with the thing and working out how much of the image is “proper” 3D Mandelbrot detail, and how much is an additional fractal contribution from the enhancement code.

But meanwhile … pretty shape!