Jump to my Home Page Send me a message Check out stuff on GitHub Check out my photography on Instagram Check out my profile on LinkedIn Check me out on Facebook

Mitch Richling: 3D Mandelbrot Sets

Mandelbrot A 0 C

Table Of Contents


When I was an undergraduate student images of the Mandelbrot set were everywhere in the media, but I only really came to appreciate the Mandelbrot set after spending some quality time learning about the underlying mathematics. I fondly recall many hours spent churning out computer programs to draw the thing at the time, and many more hours waiting for them to run! This page isn't about 2D renderings of the Mandelbrot set I first came to know as a youngster, but a class of 3D renderings of the Set (commonly called Mandelbrot Mountains).

Some of the material in this section requires a few mathematical facts about the Mandelbrot set. So take a look at that PDF before continuing -- BTW, you can download the LaTeX source if you need it.


By far the most common choice for rendering the Mandelbrot set is to visualize the L function. The general idea is to map an array of pixels making up the raster image to a rectangular region of the complex plane, and color each pixel of the image based upon a color scale for the computed value of the L function. Coding up this idea leads to the following C++ program:

The above program will generate this picture:

Typical Mandelbrot Set

While this is a pretty picture, the step changes in color visually illustrate that the function L is NOT a continuous. If we rendered a mountain from this data it would resemble the rice terrace farmlands of the Philippine Cordilleras! We want a smooth mountain, and so L will never do. What we need is continuous function, and we have two obvious choices: G and E! Here is a bit of code that will produce what we are looking for:

Smooth Mandelbrot Set

Now that we have smooth data, the next step is to somehow get that data into a 3D rendering package. The key to doing this is the cmpGreyTGA16bit in the code above. It computes a color appropriate for a special kind of 16-bit TGA file that POV-Ray can use for a height field. The following bit of POV-Ray code will read in that special TGA file, and spit out a nice "fractal mountain":

This will produce the following image::

Mandelbrot B 0


Here are a few examples. The potMandelbrot.cpp program generated all of the data for the images in this section. This data was then rendered with POV-RAY. The C++ and POV-Ray code is all distributed in the examples directory of the mraster library.

Mandelbrot A 0 T
Mandelbrot A 0 S Mandelbrot B 0 S
Mandelbrot A 1 S Mandelbrot A 2 S


I strongly recommend the book "The Science of Fractal Images" to anyone who actually wants to use a computer to generate pictures. This book has an all star group of contributing authors.

For a very interesting introduction to the history of Chaos I would suggest James Glick's book: "CHAOS: Making a New Science" (ISBN: 0-14-009250-1). This book has almost no mathematics or formal material regarding Fractals or dynamical systems, but is well worth the read for the historical perspective.

If you are looking for a good introduction to dynamical systems, I would suggest Steven Storgatz's book: "Nonlinear Dynamics and Chaos" ISBN 0-7382-0453-6).

For a good, encyclopedic, introduction to the field in general, I strongly suggest "Chaos and Fractals: New Frontiers of Science" by Peitgen, Jurgens, and Saupe. This book is notable because of it's clear presentation and breadth of coverage. It's a great book to have around for the casual reader because it is broken up into semi self-contained sections that one can just pick up and read.

© 2009 Mitch Richling