User Tools

Site Tools


I made the Mandelbrot fractal in Blender
using nothing but the node system. 1)
If you like, download and play with it. 2)

Click on any picture to see a full-sized version.

The fractal exists in the complex plane. 3)

A 2D image, with Red and Green values
for Real and Imaginary numbers, suffices.


This equation is applied to each point:

Zn+1 = Zn2 + C

where C is the point, and Z0 = C.

With real X and Y values,
the equivalent equations are:

Xn+1 = Xn2 - Yn2 + X0
Yn+1 = 2 * Xn * Yn + Y0


If a C's Zn is farther than 2 from 0+0i,
then its later Zs are all far from 0+0i,
and that C is not a part of the fractal.


Cs that remain have blue added.


Here are all of the nodes
to calculate on iteration:


Nodes are grouped together
for organization and density.

In the end, each shade of blue
is turned into a different color, 4)
and the center is turned to black.


The image is sharpened
by calculating repeatedly.

This gives a pretty result.

With more iterations,
the color bands get
harder to tell apart.

Multiplying the normalized steps
and moduloing them back to 0-to-1
makes the colors easier to distinguish.


After figuring this much out,
I found out regerogarc did, too.

I am working on better versions
and neat tricks for this project.
I will post updates when they're done.

Blender can be programmed with Python.
Using that would have made this too easy.
Instead, I used (perhaps abused) Blender's
node-based texture and image compositor systems.

These are meant to be used
to modify the surface of 3D objects
or to filter the final rendered images.

Instead, I'm using them to draw mathy\\
pictures from scratch, with no 3D models.
Because this is an unusual way to use Blender,
this project is slow and uses a lot of memory.
However, I thought it was a hack worth sharing.
I made this file with Blender 2.79b.
It should work in the latest version, too.
The math for the Mandelbrot fractal
uses numbers called “complex numbers”.
If you want to learn complex arithmetic,
you can learn about it on Khan Academy.
The “normalize” node always works, but annoyingly
makes the progress bar show 0% until the frame is done.
Replacing it with a “divide” by the number of iterations
restores the progress bar, but needs to be edited whenever
the number of iterations is changed. (Or add a script.)
blog/mandelblend/start.txt · Last modified: 2020/11/12 07:05 by avh