Keenan Crane
CARNEGIE MELLON UNIVERSITY
Ray Tracing Quaternion Julia Sets on the GPU
Keenan Crane
University of Illinois at Urbana-Champaign
teaser
preview
PDF, 946KB
About
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.

Source
Cgfragment shader only.
C++for current graphics cards. GNU Makefile and VisualStudio project.
C++/PixelShader 2.0for (much) older graphics cards. GNU Makefile only.
Executable
Windows—should work on any modern GPU.
Windows/PixelShader 2.0—for (much) older cards.
Ports
Apple has ported some of this code to OpenCL as a developer sample.
Barry Minor from IBM has ported the renderer to the Cell - it's now part of the Cell Broadband Engine SDK.
Jan Vlietinck has ported the code to DirectX 11.
Pooja Nagpal from Microsoft has ported the port by Jan Vlietinck to C++ AMP.
David Bucciarelli wrote a port using OpenCL on Linux, which includes a very nice user interface for exploring various Julia sets. He has also adapted the code to render the Mandelbulb.
The code has been incorporated into the SunFlow global illumination renderer.
The code has also been used to demonstrate the RapidMind platform
Someone has converted the code to a plugin for the vvvv video synthesis toolkit.
There is also a port to Java/GLSL courtesy of Andreas Meisel.
Tom Beddard has ported the code to an Adobe Pixel Bender filter (which apparently can be used as a Photoshop plugin), as well as a Quartz composer patch -- he's also added some really nice looking ambient occlusion.
Paul Obermeier has a port to Tcl.
Robert Varga has included the code in his DirectX 11 benchmark suite.
Nicolas Garcia Belmonte has ported the code to a WebGL-based framework called PhiloGL.
Thanks to Leo Fink for informative discussions about his AltiVec Julia renderer Gaston.
Images
figure1
figure2
figure3
figure4
figure5
Older images rendered on NV35.