How to Render a Mandelbulb

This short tutorial covers how to render a Mandelbulb via a .ass file. We are generating a "Mandelbulb" 3D version of the Mandelbrot and Julia sets. For more information about how to generate the Mandelbulb, see the Large Datasets from Procedurals tutorial.

A closeup of the Mandelbulb. You can clearly see that it is formed of thousands of tiny spheres.

A Julia set is the set of points on the complex plane that when squared and added iteratively to a constant (C), the 'prisoner' points fail to leave a circle of radius 2. There is a full Julia set for all possible values of C; C is a 2-dimensional value on the complex plane.

Julia sets come in 2 different types:

  1. Completely connected.
  2. A disconnected Cantor dust of points (for more on Cantor dust - http://en.wikipedia.org/wiki/Cantor_set)

If the center point (0,0) of a Julia set is a prisoner point, then the Julia set is completely connected; if it is not a prisoner point the Julia set is a Cantor dust.

The Mandelbrot set is the set if all fully connected Julia sets. It is generated by sampling the center point of all possible Julia sets. That means, for every point on a mandelbrot set, you can generate a Julia set. Although both sets are continuous functions in the complex plane, they are usually rendered by sampling an even grid (pixels), and if the point is a prisoner point, it is rendered black.

The Mandelbulb extends this math into three dimensions. This generator works by sampling all points in a regular grid, and if the point is a prisoner point, it adds it to an AiPoints geometry node for rendering.

You will need the following files to create and render the Mandelbulb:

Compiled Mandelbulb procedural

Arnold 6: All platforms

Note:

Ensure that you are using an up to date version of Arnold before following this tutorial. Otherwise, you may encounter problems when rendering the Mandelbulb.

Ass File

To install the Mandelbulb procedural, you have to add it to the plugins search path (use the ARNOLD_PLUGIN_PATH environment variable or run kick -l). When the plugin is loaded, you can use the Arnold procedural node named Mandelbulb in the scene.

You can assign a shader to the Mandelbulb Arnold Procedural (stand-in). Create a light and render the scene. It will take a moment before rendering to generate the Mandelbulb.

See this .ass file for an example.

You can also set the mandelbulb.dll file directly in an Arnold Procedural and use the User Options field to define custom parameters.

Gridsize

Gridsize is the number of cells in the grid, i.e. 800 x 800 x 800.

To increase the resolution of the Mandelbulb, you will need to increase the grid size. Higher numbers will create more spheres. Be careful when increasing this number as memory use and render times will increase.

Gridsize: 400 Gridsize: 800

Maximum Iterations

Maximum number of iterations to try. If after this number of iterations, the point is still inside a sphere of radius 2, then it is assumed to be a prisoner point.

Max iterations: 3 Max iterations: 9

Power

In two dimensions, Julia sets, and Mandelbrot sets are computed by iterating Z raised to a power of 2 added to C. In three dimensions, raising to a power of 8 gives more interesting results, but there is a control to try changing this if desired.

Power: 4 Power: 8 Power: 12

Spheremult

This is a multiplier for the radii of the spheres in each cell; larger spheres will blend better, but will make it 'puffy', smaller spheres will show the grid more.

Spheremult: 1 Spheremult: 2

Orbitthresh

If a point doesn't iterate out farther than this distance, it is assumed to be well inside the Mandelbulb and will not be added for rendering; this clears out a large hollow area in the center of the Mandelbulb, making the geometry a bit lighter.

Orbitthresh: 0.05 Obritthresh: 2

Chunks

This is the number of chunks to break the Mandelbulb into, so you are not building the entire set in ram at once. Higher numbers should use less ram, with a saturation point at around 30.

Threads

The number of threads to spawn when sampling values on the grid.

Julia

A switch to render as a Mandelbulb, or a julia set

Julia: Off Julia: On

Cval

A value for C used to generate a julia set; ignored if julia == off.

That concludes this tutorial. Have a go at increasing the grid size in the .ass file and adding some more interesting lighting effects.