The goal of this project was to render a
rocky pond, as seen
in the thumbnail to the right.
The ripples on the surface of the water focus
sunlight into bright lines on the rock bed. In
computer graphics, the rendering of such "caustics"
has traditionally been difficult. The recently
developed technique of photon maps has been applied
successfully to this problem; however, most computer
generated images show caustics on flat geometry. The
scene above is interesting because of the projection
of caustics onto a complex, realistic surface.
[Original proposal]
Final Images
Closeups of the rockbed through the water. The first
image contains rocks that were modelled with AC3D. The next three
contain ellipsoidal rocks defined with a height field. The final image is
a link to an mpeg animation.
Rendering System Components
Photon Map
Water Surface
Rock Bed
Animation
Water Reflection
Photon Map
(Prashant and Ren)
Our emphasis in this project was to simulate the
caustic light effects generated by the focusing of sunlight through the
undulating surface of the water. We simulated these effects using photon
maps, as described by Henrik Wann Jensen.
Implementation
We stochastically traced photons from a directional light source, aimed at
the profile of the water's surface. Russian roulette was used to decide
whether a photon was diffusely reflected, specularly transmitted or
reflected, or absorbed, based on the reflectance function for the surface.
A KD-Tree was used to store photons for quick access during the rendering phase. For our scene, all the light was filtered through the water's surface before being deposited on the rockbed. Typically 200,000 - 1,000,000 photons were stored for the final renderings.
During the rendering phase, stored photons were used to estimate the radiance from a surface point to the eye. The estimate was made by summing the flux of the nearby photons and normalizing by the area of the surface patch which contained the photons used in the estimate. In addition, a cone filter was used to more heavily weight photons near the surface hit point.
The image to the right shows a standard test case of a sphere in a cutaway cylinder, illuminated by two lights. About 350,000 photons were stored in the map, and 200 photons were used in each radiance estimate.
Casting and storing more photons sharpens the definition of the caustics,
because the variance of the radiance estimates becomes less. This effect is
illustrated in the following visual comparison.
Task Breakdown
Prashant implemented the subsystem for randomly generating photons from each light source, and enhanced LRT's WhittedIntegrator to estimate caustic radiance from the photon map. Ren implemented the KD-Tree, the tracing of photons through the scene, and the cone filter for radiance estimation.
Water Surface
(Ren)
We created a procedural language to allow the water surface to be
specified as a sum of time-varying, circular and linear cosine waves.
Implementation
The water surface is a triangle-mesh approximation for a height field. The
height field is controlled by parameters in a RIB file that allow several
different types of linear and circular waves to be composed on the same
surface. Each type of wave has several degrees of freedom, providing
flexibility in modeling the water surface for pleasing caustic
effects. For example, the circular wave is affected by the following parameters: center, amplitude, speed, time of generation, half-life for decay (amplitude of wave decays with time).
The image above shows the caustics generated on a flat, sandy bottom, from several circular waves of large radius.
To tesselate the height field, it was bounded to its intersection
with the viewing frustum. Then, a simple adaptive subdivision algorithm
was used to tesselate it with triangles. Beginning with a regular triangle
mesh, each triangle was analyzed for precision. If the midpoints of its edges were not sufficiently close to the actual position of the height field, then the triangle was split in four. A subclass of LRT's TriangleMesh was created to allow interpolation of the surface normals; these normals were interpolated from the normals at each vertex, which were precisely calculated from the height field itself.
In addition, the height field surface was extended to allow ellipsoidal bumps to be defined. A second height field, below the water's surface, was used in some test cases to approximate a sandy bottom with a small number of ellipsoidal rocks.
Rock Bed
(Prashant)
The rock bed was created entirely using the modelling package
AC3D. The rock bed structure was created by manually placing
individual rock models together. The rocks were textured using Perlin's
noise function.
Implementation
With the use of Perlin's noise function, a simple, yet realistic, texture
could be created for the rocks. A close-up of the actual rock texture is
shown in the adjacent image. The colours for the rocks were sampled from the
original image.
Rocks were created using the modelling package AC3D. The geometric
primitive underlying each rock was a sphere. These spheres were warped
appropriately to give a convincing natural appearance.
Once individual rocks were created, they were placed together again in
AC3D. The rocks were placed overlapping, to give the appearance of
a rockbed, where most of the rocks have merged together to form a
continuous rock bed surface.
Animation
(Ren)
The scene was animated by rendering individual frames and composing them
using Berkeley's free mpeg_encode software. Elements of the scene that
were "time-aware" would change from frame to frame as the time was
incremented.
Two such elements that changed with time were the waves in
the scene, and a rotation matrix that was designed to simulate a camera
fly-around of the scene. These time-varying elements can be seen in
the final animation (Final Images section above).
Implementation
LRT was extended to allow definition of time sequences on the command
line. A master LRT process would spawn slave processes to perform the
rendering for each frame sequentially. This master-slave paradigm
prevented an assertion failure from terminating the entire frame-generation
sequence. Multiple master processes were used to parallelize the rendering
across several workstations.
The animation above was a test case for the water surface
subsystem, and demonstrates some of the waves that can be procedurally
generated.
Water Reflection
(Ren)
A distinctive visual characteristic of water is its increasing reflectivity
at glancing angles. This effect is characterized by the
so-called Fresnel term in the shading model. In our original photograph,
the effect is most pronounced at the top of the image; the reflection of
the sky on the surface of the water is greater near the horizon.
Implementation
We incorporated the Fresnel effect into the surface shader function for
LRT's GlassSurface. The Fresnel equations were found in [Glassner, 149].
The sky was modeled as an infinitely large, light blue sphere. If
reflected rays did not intersect a surface, they were assumed to intersect
the sky.
The image above shows a test case with no photon casting, where
the Fresnel term is allowed to dominate.
References
Berkeley Multimedia Research Center, BMRC and "mpeg_encode"
software.
Glassner, A., An Introduction to Ray Tracing. Morgan Kaufman, 1989, USA.
Wann Jensen, H., A Practical Guide to Global Illumination Using Photon
Maps.
|