The images on this page were generated in real time by a GPU fragment program which ray traces
quaternion Julia sets. I was recently asked to write an
article on this project, which gives a (hopefully) simple introduction to the quaternion Julia set and ray tracing it on the GPU. The original algorithm for ray-Julia intersection can be found in the paper
"Ray Tracing Deterministic 3-D Fractals". This kind of algorithm is pretty much ideal for the GPU - extremely high arithmetic intensity and almost zero bandwidth usage. One nice thing about ray tracing fractal or implicit surfaces is that they are represented by a few simple constants, and are therefore much more cache friendly than meshes, which may require vastly different memory accesses across a set of rays. Unfortunately, GPUs still suffer from coarse branching granularity, which means that incoherent rays will waste time waiting for each other to finish.
This renderer was originally developed in early 2004 when fragment programs could take up at most 1024 instructions (I used something like 1022!) with no dynamic flow control. At the time I was pretty amazed that I could even get it to work, but wasn't satisfied with the limited amount of surface detail available given the instruction limit (see the last two images below). A very slight modification for current hardware has resulted in images which look largely the same as CPU renders.
The accompanying article originally appeared on DevMaster.net.