Rendering Smoke with Particle Maps

Rendering smoke has traditionally been done using particles, or by ray marching though a volume, filled with some procedural density function. While particles are easier to control, the use of an atmosphere shader to add fogging to a scene is somewhat cleaner.

Photon maps are basically a method of collecting all of the particles within the vacinity of a point in space. If we then divide the number of particles by the volume over which we searched we get an approximation to the density of particles in that regeon. Rather than storing photon's in such a map, any partcle simulation can be used.

By re-writing Photon mapping code into a renderman DSO-shadeop we get a density function which can be simply dropped into any ray marching shader. Because of the highly optimised kd-tree used in photon maps, the function is fast (and scales to huge numbers of particles), but the underlying particle system gives is controll over the smokes location.

Downloads

You can download the powerpoint presentation and the example source code. This source code includes a fix, as the version originaly posted had a stupid mistake in (sorry!). Aparently there's also a problem reading the powerpoint on certain versions of Office (windows PP can't read Mac PP files!), so Steve Hill sent me this version which might work better.

The code to generate maps included in the tar file is intended as a demo - I'd recommend looking at the code for gen, and incorporating it into your own particle simulation code, to generate maps directly. However to get you started you generate can particle systems in a RIB file and them to the raw format similar to the demo file using my particleGen program ( Linux, FreeeBSD, SGI )

This technique was presented as a Stupid RenderMan Trick at the Pixar user group meeting in San Diego, July 2003.

Ian Stephenson.
DCT Systems
NCCA, Bournemouth University