Using Mandelbrot
alex — Sat, 08/09/2008 - 20:16
Mandelbrot is a plugin for Quartz Composer which can be used to generate fractal imagery and animations either for their own sake or as the basis for further processing.

This discussion assumes you have Quartz Composer installed on your Mac, that you are running Leopard, and that you have downloaded and installed the Mandelbrot QC Plugin.
The Mandelbrot patch
Once installed, Mandelbrot will be available in the Patch Creator list. Drag the patch into your editor and an instance of the Mandelbrot will be added to your composition. The patch looks like this:

If you click on the patch and open your Inspector window, you will see the available parameters for the Mandelbrot generator:

Parameters
Input
- Fractal: Mandelbrot or Julia algorithm
- Width: The width, in pixels, of the generated image
- Height: The height, in pixels, of the generated image
- Max Dwells: The number of iterations before the pixel is considered to have escaped
- Colour: The algorithm used for choosing a pixel colour:
- - Escape time: Simple time to escape
- - Palette: Escape time chosen from a modified palette
- - Distance Estimation: Double logarithmic multiplied escape time
- - Continuous: Double logarithmic added escape time
- - Smooth: Logarithmic added escape time
- Red, Green, Blue: Hue modifiers for the colour algorithm
- X: The real seed of the fractal
- Y: The imaginary seed of the fractal
- Zoom: From 5 to 0.000001, smaller numbers are higher zoom levels
- Julia X and Y: An offset to allow the Julia to be centred
Output
- Image: The fractal image as rendered with the input parameters
Speed
The Mandelbrot is a very intensive algorithm: consider that a 512 x 512 pixel image with Max Dwells set to 512 may need to perform as many as 402,653,184 calculations to determine each pixel's colour (512 x 512 x 512 x 3). This can bring even the fastest processor to a grinding halt.
In order to minimise the strain on your cpu, the Mandelbrot is only calculated when a parameter changes. If you don't need to animate your fractal imagery the cpu cost is acceptable for still image renders. If you have a slower cpu, this may be your best option.
Version 0.6a includes a number of optimisations which improve rendering speed by about 5 times over the earlier versions. I now see framerates of 2 - 15 fps on a 2.4GHz Core2Duo. I hope to optimise this further in future versions.
It may be helpful to know that black pixels (the pixels inside the set) require the longest calculation times. Therefore, the larger the area of black in a render, the longer it will take.
Bundled Compositions
The MachineCodex Mandelbrot QCPlugin installer disk image contains three Quartz Compositions to get you started using the Mandelbrot patch.
Mandelbrot Explorer

Mandelbrot Explorer provides a simple interface for exploring the Mandelbrot set. It contains a Mandelbrot, a Billboard to render the Image output, and a set of crosshairs to aid in pinpointing the centre of the view.
In the Inspector, try moving the X and Y sliders to centre an interesting point on the edge of the Mandelbrot set in the crosshairs. Then adjust the zoom slider towards the left... but not too far! One of the limitations of the Quartz Composer interface is the coarse slider resolution. To enter small enough values, you may need to type numbers into the Zoom text field. Some interesting X, Y and Zoom values are suggested below:
| Name | X | Y | Zoom |
|---|---|---|---|
| Mini me | -0.6277 | 0.0 | 0.0037 |
| Electric | -0.256 | 0.381 | 0.068 |
| Fleas | 0.3088 | 0.219 | 0.001104 |
| Feathers | 1.426 | -0.3088 | 0.1838 |
You can disable the crosshairs once you have found a good region. Then choose Save snapshot from the View Menu (Cmd-Shift-C) to save an image of your Mandelbrot. With this plugin installed, Quartz Composer becomes a fairly competent Mandelbrot set explorer. When you combine the image ouput with a few CIFilters and other effects, you can create some stunningly complex and different imagery.


Mandelbrot Zoom

A variation on the Mandelbrot Expolorer which demonstrates the use of an Interpolate patch to perform an animated zoom into the Mandelbrot set. Typical frame rates are between 0.4 and 2 fps on an Intel Core cpu.
Julia Interpolate

The Julia Interpolate composition demonstrates the use of an Interpolate patch to vary X between 2 interesting values. The interpolation is inverted through a Math patch to hold the Julia set centrally in the view using the Julia X parameter.
The Julia set, a closely related fractal to the Mandelbrot, contains many areas of extraordinary beauty and symmetry. It also contains many areas which are devoid of interest. More so than the Mandelbrot, the X and Y values are crucial for finding interesting images.

Some interesting X, Y and Zoom values are suggested below:
| Name | X | Y | Zoom |
|---|---|---|---|
| Dragon | 0.2973 | 0.4853 | 2.684 |
| Nouveau | -0.4853 | 0.5735 | 3.125 |
| S | 0.3971 | 0.1324 | 3.125 |
| Paisley | -1.279 | -0.04412 | 0.2103 |
Conclusion
We plan to continue developing Mandelbrot to improve performance and add features. Please let us know what you think and make feature requests and suggestions below.
- Printer-friendly version
- Login or register to post comments
