Underwater Scenes

Our original plan was to render a scene of the ocean surface with killer whales as described in our project proposal (http://graphics.stanford.edu/cs348b-06/JulieTung/FinalProposal). However, when we began trying to model the surface of the ocean and the physical propoerties of waters as it interacts with large bodies (like whales), we decided that this focused too much on modelling the physics of the water and not enough on the actual renderering. We found equally stunning underwater photos of killer whales so we decided to do an underwater scene instead. Implementing photon mapping through participating media also seemed like a more contained project, so we went with that instead.

Volume Photon Mapping

PBRT already has photon mapping implemented for direct/indirect lighting and caustics; however, for an underwater scene, there is often plankton or dirt or other elements in the water that interact with the photons as they travel through the water. To simulate this we used the method described in Jensen's paper, Efficient Simulation of Light Transport in Scenes with Participating Media using Photon Maps. We allow the user to pass in a "volumephotons" parameter that specifies the number of photons to collect. During the photon shooting stage we first check to see if the photon is in a medium that scatters (in this case water), and if it is, we ray march at a jittered constant step size. In the Jensen paper they used the rate of absorption to decide the step size and control the rate of interaction, but for us, the constant step size yielded more visually pleasing results. At each step we use Russian roulette to decide whether the ray is absorbed or scattered.

In order to insure that our photon shooting algorithm was working correctly we tested our algorithm in a modified cornell box (half filled with water) -- obviously it wasn't quite working yet here. =P attach: cornellbox-crazy.jpg

[[br]]

We also outputted the collected photons to a file and visualized using tiny spheres for the photons. attach: photonvis.jpg

One problem we ran into was that water absorbs different wavelengths of light at different rates (the lower frequences are absorbed more quickly) leading to water's blue color. However, Jensen's paper didn't mention how they dealth with this, and in previous final projects on this topic, they used a single absorption coefficient for all color channels and then artifically changed to color of the light. We wanted to be able to simulate the effect where water looks colorless in shallow depths but gradually gets more blue as you have more depth. So we defined a rate of absorption for each color channel and then when we store the photon during ray marching we scale each channel based on the rate of absorption for that channel. As a result we were able to obtain images where the water starts off nearly white at the surface and gradually becomes more and more blue as the water gets deeper.


attach:blue.jpg

Rendering

We also used a jittered fixed step size during ray marching to collect the photons in the Volume photon map. Our original images turned out really strange and polka dotted. We ran some debugging stats on it and found that we were collecting too few volume photons (as well as using a radius of collection that was much too small), and as a result many rays failed to collect any photons while the ones that did turned out really bright. After turning up the number of volume photons as well as increasing the radius of collection we obtained much more reasonable results.

The Whale

We attempted to use Lightwave to model the whale but after several failed attempts, we decided to buy a 3ds model of a whale online. We then built the utility that we downloaded w/ the pbrt package, 3ds2lrt, to export to the pbrt scene format. We ran into some trouble when we tried to texture the whale. However, after much experimentation, we realized that the u,v coords were flipped in one of the directions, so we flipped the image in photoshop and everything was dandy.


We used a test texture with wacky colours to figure out what was wrong w/ the u,v coords of the texture. attach:whale1.jpg


The correctly textured whale model attach:whale2.jpg

God Rays and Caustics

In order to enhance the realism of the scene we wanted to have god rays and caustic effects in the scene. How well the god rays came out depended a lot on the surface of the water, the step sizes of the shooting and collection phases, and how many photon samples were collected.

alexli/final (last edited 2006-06-10 00:06:05 by myth22)