Your mission is to add photon mapping to a ray tracer. You can use the same code base that you used for the radiosity assignment, or any other ray tracer that doesn't already do photon mapping or nontrivial scattering media is fair game. The due date is April 1.
I've decided to have you work in a single team again, because some of the more challenging features are too much fun to pass up. There should be plenty here to keep you all busy!
The requirements are:
Here are the still images you should render to demonstrate your system:
You will likely find it helpful to have every volume attached to a "clipping surface" so that the volume only exists inside the volume defined by that surface. You will need to clip the water surface to the inside of the glass. Also note that you will need some kind of mechanism by which a ray, when it exits the glass, figures out whether it is going into water or into air.
The data formats are unfortunately many and varied. The smoke data is in a self-explanatory (I hope) text format, and the Buddha triangle mesh is in the CS417 XML format. The water glass is a triangle mesh in the ASCII Ply format, which shouldn't be too hard to figure out. If you're interested, you can also see the Bézier spline from which it was made (in Adobe Illustrator format, which is actually nicely documented)
The water data is in a simple binary format that is read by the code
in levelset.cc
. This code
(hastily written though it is) can also serve as an example of how to
interpolate volume data and how to intersect rays with the level set. Feel
free to cut and paste as much as you like into your program. Note that the
water data has the special property that the numbers in the volume represent
the distance to the closest point on the surface, which enables considerable
acceleration by taking big steps when far away.
To make the glass fit the water in the past, I have used the transformation:
translate 0 46 0 scale 0.005 0.005 0.005 translate 0 -1 0