03
Jul
09

3D Mandelbrot Set

3D Mandelbrot Set, based on Daniel White’s formula for squaring a 3D hypercomplex number

This is my favorite hypercomplex fractal, based on Daniel White’s creative formula for squaring a 3D hypercomplex number by applying two consecutive rotations. I’m not sure how mathematically meaningful this is, but it is stunningly beautiful. Here is some Mathematica code demonstrating a simple way to render this 3D fractal as a depth map by slowly marching tiny cubes (voxels) toward the boundary:

```(* runtime: 1 minute, increase n for higher resolution *) n = 100; Norm[x_] := x.x; Square[{x_, y_, z_}] := If[x == y == 0, {-z^2, 0, 0}, Module[{a = 1 - z^2/(x^2 + y^2)}, {(x^2 - y^2)a, 2 x y a, -2 z Sqrt[x^2 + y^2]}]]; Mandelbrot3D[pc_] := Module[{p = {0,0, 0}, i = 0}, While[i < 24 && Norm[p] < 4, p = Square[p] + pc; i++]; i]; image = Table[z = 1.5; While[z >= -0.1 && Mandelbrot3D[{x, y, z}] < 24, z -= 3/n]; z, {y, -1.5, 1.5, 3/n}, {x, -2, 1, 3/n}]; ListDensityPlot[image, Mesh -> False, Frame -> False, PlotRange -> {-0.1, 1.5}]```

I had to write my own isosurface ray-tracer in order to render these fractals. The above image was made to look like a cloud of smoke using a volumetric technique described by Krzysztof Marczak. The image on the left was made using James Kajiya’s path tracing method for Global Illumination (GI).

Global Illumination and Participating Media Links

Higher power variations of this fractal can be rendered based on the following formula:
{x,y,z}n = rn{cos(nθ)cos(nφ),sin(nθ)cos(nφ),-sin(nφ)}
r=sqrt(x2+y2+z2), θ=atan(y/x), φ=atan(z/sqrt(x2+y2))

2 Responses to “3D Mandelbrot Set”

1. 1 Shears
August 29, 2009 at 3:47 pm

I get error in Mathematica: SetDelayed::write: Tag Norm in Norm[x_] is Protected.

• 2 nylander
August 29, 2009 at 4:16 pm

You are using a newer version of Mathematica that already has Norm defined. Just remove that line and it should work (unless there are other changes to the newer version of Mathematica that I don’t know about).

Welcome !

You will find here some of my favorite hobbies and interests, especially science and art.

I hope you enjoy it!

Subscribe to the RSS feed to stay informed when I publish something new here.

I would love to hear from you! Please feel free to send me an email : bugman123-at-gmail-dot-com Berna Blalack on Magnetic Pendulum Strange… Daan on Magnetic Pendulum Strange… Sebastian Schepis on Diffusion Limited Aggregation… mohammad_andito on CFM56-5 Turbofan Jet Engi… SasQ on Magnetic Field of a Solen… OUPblog » Blog… on Diamond Light Dispersion Complex Roots on Polynomial Roots Joukowski airfoils |… on Joukowski Airfoil Karim Alame on Flapping Wing REJISH J on Joukowski Airfoil SOLINOID | Materials… on Magnetic Field of a Solen… Emanuele on 4D “Squarry” Julia… Emanuele on Hydrogen Electron Orbital Prob… Tim on Mandelbrot Set Pickover S… khankasi1 on 4D Quaternion Mandelbrot …