3D Mandelbrot Set

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

Volumetric, imax=24

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}]


Global Illumination, imax=24

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))







Minibrot, imax=20

Mandelbrot zoom, imax=24


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).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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


Blog Stats

  • 561,374 hits

%d bloggers like this: