Wednesday, October 20, 2010

Mandelbrot revisitted

Recently I was updating one of the first shaders that I created with mental mill called fractal. What I love about fractals are, that a simple algorithm yields such impressive shapes with sheer endless details. Obviously I was intrigued and was inspired to write a shader that made use of them.

One thing that I like about working with mental mill is, that you can make any parameter tweakable. So if you have a formula that uses three variables, they don't necessarily have to be constants. Instead you can edit them through the mental mill GUI. Sometimes you can yield surprising results by making variables tweakable that are 'not supposed' to be tweaked.

That happened to me when I recently revisited the MetaSL code for my fractal shader. I was looking at the abort conditions in the fractal loop. There are two conditions:
  1. If the squared distance of the original point exceeds 4.0, then the point is not part of the set and is discarded.
  2. If the iteration exceeds the maximum number of iterations the process stops. At this point it is not certain whether the point will diverge or not, however it is regarded to be part of the set.
There is not much one can change about the second condition (and the number of iterations is already a shader parameter anyway). Making this a parameter made the abort condition tweakable with some astounding results. If you lower the value, you can see how the rendering morphs into a cartoony look.

This is quite surprising and beautiful to see. If you adjust the values carefully you can get some really great pictures. If you want to use the shader in mental mill, you can find it here. TThe shader parameters are straightforward. You can switch between the Mandelbrot and the Julia fractal. However, if you want to view the Mandelbrot fractal in its original shape, you must set the shader input parameters start_real and start_imaginary to 0.
Here are some other presets that I created using that shader:

That's it for now. By the way, there is a lesser known variation of the Mandelbrot fractal: The Buddhabrot which unveils even more fascinating shapes. Check out Melinda Green's page!


No comments:

Post a Comment