The mandelbrot fractal is really interesting, and also very simple to implement so it's a nice starter project
It's a learning project for dear-imgui, opengl and c++,
with the goal of implementing various mandelbrot algorithms, and julia sets in the future.
Robert Munafo's https://www.mrob.com/pub/muency.html blog is full of tips and information on
implementing mandelbrot algorithms and was of great help.
This algorithm computes the time needed for a complex number
Here,
Any point while(mag(z) <= 2 && iter < max_iter)
This algorithm is less known, by me too as it was my first time implementing it.
It checks if the sum of the derivatives is bigger than a given value, in which case it stops.
This algorithm has the benefit of showing some structures inside the bulbs
According to wikipedia, the derivative
Wikipedia also gave a python sample which I translated in glsl for my first attempt at implementing it in fs_derivative.glsl:
My second attempt in fs_derivative_2.glsl used the definition, and with a few tweaks for the coloring, seems to give satisfying results:
Because the iteration count is an integer, at low iteration counts,
some color bands are very visible and does not natively allow for smooth
transitions between one iteration to the other.
From Robert Munafo's website, after computing the final iteration count
The final results are a nice smooth gradient:
This code is under the MIT License