This program uses github.com/gogpu/gogpu with some basic WGSL shader code to render and zoom in on Mandelbrot and filled Julia set fractals.
The quality of the rendered fractals, in terms of the fine structure details revealed, and the depth and steepness of the color gradients applied to those structures, is compromised to varying degrees (depending on the specific fractal) by the choice of the set of one-size-fits-all parameter values in certain functions:
- the constants in the cosine interpolation function used to smooth color transitions in the pre-computed color palette
- the constants in the functions used by the shaders to select per-pixel colors from the pre-computed color palette:
This was a deliberate design decision motivated by the desire to keep the core math functions relatively simple, at least for the first working versions of the program. The quality of the rendered fractals can definitely be improved by using more sophisticated math functions chosen specifically for each individual fractal, or perhaps subsets of fractals.
No anti-aliasing is applied to the rendered images, further degrading their quality, especially as each frame transitions to the next increased-magnification rendering (i.e., high-gradient regions appear to scintillate or flicker as the viewport zooms in).
$ go run . -help
fractal usage:
-fractal string
canonical fractal name ("seahorse", "dendrite", etc) (default "elephant")
-theme string
color scheme ("green" or "red") (default "green")
-type string
fractal type ("mandelbrot" or "julia") (default "mandelbrot")