The famous Mandelbrot set of fractals is beautiful and the Julia sets are also wonderful to explore. For the longest time I have had the same computer background of a Julia set found with Fractal eXtreme which looks like the eyes of an owl. Having seen the Buddahbrot coloration some time around 2016 I have thought about making a new background with this coloration method. After researching it I realized how simple and elegant the method was and decided to play with creating a renderer in MATLAB for this background.

Background Information

The Buddhabrot Image is simply a coloration technique developed by Melinda Green to render the Buddahbrot set. Instead of coloring pixels based on the escape speed of their chosen points, the pixels are painted in along the way. That is, the iterative calculations are done the same way as the usual Mandelbrot set, but each point in an iterations will land/reside in a given pixel, so that pixel is painted in slightly to represent the escape path passing through it. This is typically referred to as the "hit count" on a pixel, but I liked the idea of slowly painting in the picture. As well, only the paths that escape (do not exceed the iteration limit) are added to the "hit count" since the non-escaping paths would obviously muddy the image, and are considered to be within the Mandelbrot set.

The MATLAB Script that I developed for this renderer required some speeding up after the initial verification tests. An important part of the Algorithm is increasing the number off "paint brushes" being used to paint the image. As you can imagine the Mandelbrot set, using this coloration method or any other, is simply a remapping of the Cartesian plane. Thus the initial position of the paint brushes will map/paint exactly the same way during each run of the renderer. This will produce a representative image but show plenty of apparent noise due to the binning of the pixels and precise nature of the painting/escape paths. To reduce the noisy look of the render, more paths need to be calculated with some small perturbation. This added chaos in the form of some random points within the same starting pixel creates the smooth image that is shown above.

Speeding it up

My desired Image only required an iteration limit of 100 but still took quite a while to render. Due to the fact that so many extra iterations have to be done in order to create a smooth image, the render can take tens if not hundreds of times longer than the equivalent normal Mandelbrot render. This meant that the large 10,000 pixel square image that I wanted to render would require over a day to render given the naive calculation method I was using. The easiest way to speed up the code was actually via the basic calculations during each iteration. Instead of squaring numbers, multiplication could be used. As well, reduction of other squaring operations such as the check for escape beyond the 2 unit circle could be reduced to a check against the square of the 2 unit distance, i.e. A^2+jB^2 = 4 instead of A^2+jB^2 = 2^2 where A^2 and B^2 are pre-calculated for use in multiple steps. All told, these simple arithmetic changes improved the algorithms speed by ~26 fold. It is only a constant factor improvement, but a significant one at that. This meant that I could render my desired 10,000 pixel square background in less than 2 hours without parallel processing.