Keenan Crane
Email
Phone (502) 821-3239
Mail MC 256-80 
California Institute of Technology
1200 E California Blvd
Pasadena, CA 91125
Calendar
Home Images Misc. Projects Publications CV Links
 
Ray Tracing Quaternion Julia Sets on the GPU

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 are equivalent to CPU renders.

Recently, Barry Minor from IBM has ported the renderer to the Cell - it's now part of the Cell Broadband Engine SDK. The code has also been used to demonstrate the RapidMind platform and converted to a plugin for the vvvv video synthesis toolkit. More recently the code was ported to the SunFlow global illumination renderer.

An executable and zealously documented source code are available below. The fragment shader which performs ray intersection (i.e., the interesting part) is also available in syntax-highlighted HTML. The program requires Cg, GLUT, and a graphics card supporting Shader Model 3.0.

Update: By popular demand, I've also released the older version of the ray tracer. This version will run on most PS 2.0 hardware as long as it supports a large enough number of instructions (e.g., I've been able to run it on GeForce FX cards, but not Radeon 9700 Mobility). Because dynamic branching was not supported on older hardware, this version of the ray tracer executes much faster: no fragments are ever stalled. However, the limited instruction count results in less detail.

Thanks to Leo Fink for informative discussions about his AltiVec Julia renderer Gaston.

Source for newer version contains a VisualStudio project, older version contains a Linux/Mac makefile, but both are pure GL/GLUT/Cg and should require little modification to get working on other platforms.

The (highly un-restrictive) license associated with this software can be found here.

Images rendered on NV47/G70:





Older images rendered on NV35:

Most of this content is probably copyright 1984-2005 Keenan Crane.   Spam bots: please send spam to l22sk2_2xf1t4@hotmail.com.