The topic of our project is Participating Media, and in particular atmospheric
LRT Source Code (tar'd/gzipped). In the original picture, we have light streaming through a dusty room giving the appearance of a haze, near the window, that blankets the lamp and the table. To simulate the same effect, we have to render the space as it if was a volume filled with dust particles.
In particular, each dust particle will absorb light as well as scatter light from nearby sources. This is simulated by Ray Marching, an numerical approach that integrates the effect of dust particles along the path of each light ray. Our implementation, divides each eye ray into n (20 for our rending) steps. At each step, it updates the irradiance to take into account absorption and scattering. The amount of scattered light is computed by shooting a ray to a light source, and attenuating according to the absorption along the path to the light source. For our simulation, the amount of light scattered depends upon the direction. We use the Henyey-Greenstein phase function to modulate the amount of light scattered. The g, 0.9, we chose heavily favors forward-scattering.
We also wanted to render a scene where the density of the volume was not constant. This is commonly used to render smoke or clouds. To generate a natural-looking density, we decided to go with Perlin noise. Perlin noise is a fairly simple of way generating a noisy distribution by overlapping several copies of a signal generated at different frequencies.
Our implementation generates a 3D grid of noise values. This grid covers the entire scene. At each point in a space, we compute particle density by lookuping the neighboring values in the grid and doing trilinear interpolation. This saves having to re-generate the noise values over and over again.
Finally, to get the color smoke, the particles have to emit as well as absorb and scatter light. We added a our volume renderer so that at each Ray March step, a fraction of the a base color is added to the light. This fraction depends on the particle density at that point and an empirically determind scaling constant. Rendering the final scene of a room with a smoke, we get the following image.
A smoke filled room
Here is the picture of the an room without any dust in it
Here is a picture of a scene rendered with clouds of red dust in it.