Fast Mandelbrot set rendering

by asfarley

This demo is written for the Gameboy Advance. The GBA uses an ARM7 processor; the devkitpro toolchain can be used to compile Gameboy ROMs as described in the Tonc tutorials.

Plotting the Mandelbrot set isn’t particularly difficult. It does, however, plot very slowly (1 or 2 min for full resolution – 240×160 at 32 iterations per pixel ). It’s nicer if there’s something to look at while it’s rendering. In this example, the set is plotted at progressively higher resolution. Initially it’s plotted with 15×15 pixels and only samples the image once per 15×15 pixel block. The code avoids re-calculating pixels that have already been calculated by maintaining a list of the resolutions that have been plotted so far (implicitly tracking which pixels have been sampled). This reduces the computational requirements of this early/cheap plotting routine. The only real overhead is the extra time required to block blocks instead of pixels at the lower resolution.

Code based on Tonc’s m3_demo:¬†