Rendering Ice Sculptures

CS 348b Final Project
Rene Patnode, Evan Parker

Introduction

The goal of our final project was to render realistic images of ice sculptures. Specifically we wanted to produce pictures like the followinng two:

Issues we dealt with included obtaining and creating models of our ice sculptures, modeling the environment the ice sculpture appeared in, modeling the proterties of ice at its surface and in its interior, implementing advanced surface and volume integration algorithms to render everything we wanted to model, and tracking down and fixing oh so many bugs in LRT.

Here is our original project proposal.

 

The Buddha (and a Dragon)

As an initial goal, we wanted to try to render an image that looked like the buddha above. This rendering would simulate the basic reflective and refractive properties of ice and allow us to become comfortable with LRT.

Obtaining/Creating Our Models

Obviously, we were not going to create a model of this buddha ourselves, as we do not have such skills. Instead we hit up the Stanford 3D Scanning Repository and obtained the Happy Buddha model. While there we also picked up a copy of the Dragon model, thinking that would pretty cool when rendered as ice, and indeed it does (see picture below). Unfortunately, these models come in the PLY format which is not readable by LRT, so we had to write a quick script to convert PLY models into RIB-readable polygonal meshes. Since these meshes are quite big and our AFS space is rather small in comparison, we wrote a little python script to preprocess RIB files to allow the use of the "ReadArchive" command, which essentially works like #include in C.

Modeling the Environment

We could have put our buddha and dragon in any environment we wanted (really, we could have!), but since we are trying to reproduce the picture above, we attempted to simulate the lighting from the picture. To do this we put in put our models in a box where the sides of the box were area lights of various colors. As you can see from the picture above, there appear to be two main colors of light: the bright bluish-white light and the dimmer tan light. Unfortunately, it is not at all obvious where these lights are positioned, so it took a lot of tweaking to get the right effect.

As area lights do not work with triangle meshes LRT, we implemented a new type of shape called a "Quad" and then made the box out of these quads and attached area lights to them.

Modeling the Properties of the Ice

We created a new material called "Ice" to capture the surface properties of ice. These properties include two specular components, one reflective and one transmissive, which are blended between based on the Fresnel equation for dielectrics. When light refracts into ice its angle is perturbed according to the index of refraction of ice which, as we found in numerous places, is 1.31.

Rendering

To render these ice sculptures we used the "Whitted" integrator, the obvious choice for materials with multiple specular components like ice or glass.. Here we ran into our first bug: the whitted integrator had, shall we say, "problems" with area lights. Black pixels showed up all over the place when an area light was sampled by a ray that had had a specular bounce. This took forever and day or two to debug, but we finally solved it and sent Matt Pharr our first bug report (one of many to come :).

After ironing out some other minor bugs and getting more comfortable using the LRT and the RIB file format, we came up with these pictures of our Buddha and our Dragon:

 

The Rose in a Block of (Clear) Ice

Once we had rendered the Buddha and the Dragon we thought we were could take on anything, so we jumped right into trying to render the block of ice with a rose in it. This picture is quite a bit more complex than the first one we tried to replicate. In addition to the reflection and refraction at the surface of the ice there is also an organic object inside the ice, and the surface of the ice sculpture is roughened up.

Obtaining/Creating Our Models

We used Milkshape 3D, a shareware modeling program, to create the block of ice. The model of the rose we found online at 3D Cafe. After importing it into Milkshape, we modified it heavily. We attempted to make both the block and the rose match the original picture as closely as possible. We also scanned in an actual rose leaf and applied it as a texture to the leaves of our model.

Here are some pictures of the modified rose model we used, and the picture of the leaf we used as a texture:

We ran into many problems importing models from Milkshape into LRT, due to various bugs having to do with shading normals and orientation.

Modeling the Environment

The lighting in the original scene is unclear. We actually suspect the background may have been photoshop'ed b/c it seems a bit too perfect. But we tried our best to reproduce the scene. As with the dragon and the buddha, we placed the scene in a box with lights on the sides. Again we ran into problems with area lights and integrators...so instead of debugging them again we just model the walls as translucent and place directional lights outside the scene box. We also place a spotlight below the reflective floor pointing up and back to get the halo effect on the wall behind the rose.

Modeling the Properties of the Ice

The surface of the block of ice is quite rough, so we decided to use bump mapping to model this. After spending many days trying to get bump mapping to work and dealing with many bugs, we finally got around to actually making a texture to apply as a bump map. This turned out to be no easy task. Creating the texture by hand in Photoshop turned out to be far too difficult, so we turned to procedural modeling instead, which ended up working really well. By combining the Noise function and the FBm ("Turbulence") functions built into LRT, we were able to create a surface with low frequency waviness, high frequency pits, sparse rough spots, and swirling grooves. This is similar to techniques used in [Perlin 85].

Here's the equation we used, layed out pictorally:

Rendering

The main challenge in rendering the rose in the block of ice turned out to be getting light to the rose itself. The problem is that because the rose is inside another object, shadow rays that are usually used to determine lighting will hit the block and never get out, so the rose will appear black. One solution is to disregard the block of ice when tracing such shadow rays, but because light refracts at the surface of the ice this would not be physically correct. As we saw it, there are two solutions to approximate the light hitting the rose: 1. use photon mapping; or 2. trace light "gathering" rays out from the rose. We found that for our scene photon mapping tended to work rather poorly because of the fact that the surface area of the rose is quite small and the lighting is quite diffuse, hence relatively few photons shot out from light sources actually hit the rose. Here is one picture we produced using photon mapping; note that we had to use a spotlight to illuminate the block so that photon mapping was at least somewhat efficent:

The second method of tracing "gathering" rays out from the rose worked much better. We implemented this by keeping track of whether or not a ray is currently inside a specular object (as in, the ray refracted through a specular surface), and if such a ray hits a surface that contains non-specular components, our integrator samples outgoing ray directions from the BSDF of the surface some number (16 worked rather well) of times and continues (recursively) tracing rays through the scene.

Here is the final scene, and if I do say so myself it is bea-u-ti-ful:

 

The Rose in a Block of Ice with Bubbles in it

To simulate the transport of light through an ice volume defined by the air bubbles within it, we turned to volume integration techniques. Specifically, on top of the already extant single scattering volume integrator provided by lrt, we allowed shapes to claim ownership of volume regions and we added a multiple scattering term in the technique suggested by Jensen. [Jensen 98, 01]

As done by Jensen, we begin by constructing a volume photon map in a fashion similar to that used to construct caustic and general photon maps. In fact, the algorithm remains the same until the photon hits a shape which has been declared to be a volume. At that point the photon bounces around in the volume, with an average path length equal to the mean free path given by -log(zeta)/sigma_t, where zeta is a uniformaly distributed random number, and directions given by importance sampling the phase function. We continue bouncing until either the photon leaves the volume, is stopped by russian roulette, or hits another object within the volume that it should reflected off. After a reflection, the phone is then free to continue moving within the volume. We maintain knowledge about what volume(s) we are currently in (if any), when tracing photons, by making use of a volume stack; this would theory also allow us to correctly handle an arbitrary number of nested volumes, something which the current implentation of lrt does not handle well.

After completing construction of the photon maps, we begin using an integrator which combines features of the photon map and single scattering integrators provided by lrt. Like in the pre-processing stage, we maintain a stack of volumes that the currently traced ray is inside, and on top of what is already done by the photon map integrator, whenever we are inside a volume, we add the amount of light that would be scattered in along that ray to the currently radiance and attenuate the remaining radiance by multiplying it by the transmittance. All these values are calculate as per Jensen: we ray march through the volume, sending out shadow rays to check for direct illumination and searching for nearby photons to check for indirect illumination. In our implementation we use a pre-determined average step size to ray march, as we found that using adaptive ray marching as suggested by Jensen tended to produce noisy images, especially in highly varying hetereogeneous volumes.

Modeling the Properties of the Ice

In order to model the scattering properties of ice, we ended just picking values that seemed about right in terms of the pictures we were producing. Thus we fairly arbitrarily selected a very low absorption coefficient, a scattering coefficient of .2, and an isotropic phase function. Finally, we tried to model the air bubble cloud within using a technique such as given in [Perlin 85, Ebert 98], but ultimately the only really promising cloud we got was formulate with an oval shape augmented with some turbulence. The image got, while clearly not exact, still seemes pretty good.

Finally, due to the nature of the medium, the contribution given by multiple scattering is not completely obvious. However, we will note that in the image above, the photons fill in a region that would otherwise be in the shadow of the rose.

Here's a render where the bubbles have an isotropic scattering function:

 

This time the bubbles are more likely to scatter light back towards the direction it was coming from. Since the light is coming from in front of the block, this makes the bubbles appear brighter. This is a bit closer to what bubbles in ice actually look like:

 

To give a more concrete example of the multiple scattering at work, the following is in a image of the affectionately labled "egg." Notice the slight green tint in the medium around the inner ball; such an effect would not be possible without multiple scattering.

 

Conclusion

Well, we rendered the rose in the ice, so I'm happy. And we got a 2nd place prize for "Most Artistic Use of Refraction"; that makes us very happy. It would have been cool to have done more with the bubbles in the ice, but oh well. Overall, a very satisfying project. Now for sleep :)

 

Downloads

Our scene description files. We don't include the model of the dragon and the buddha as those are publically available. However, you may want to use our ply2rib script (included in this archive) to convert the models to RIB readable format.

Enjoy :)

 

References

Jensen, Henrik Wann. Realistic Image Synthesis using Photon Maps. AK Peters, 2001

Jensen, Henrik Wann. "Efficient Simulation of Light Transport in Scenes with Participating Media using Photon Maps." Proceedings of SIGGRAPH'98, pages 311-320, Orlando, July 1998

Perlin, Ken. "An Image Synthesizer." Proceedings of SIGGRAPH'85, San Francisco, July 1985

Ebert, David S. "Implicit Modeling with Procedural Techniques." Baltimore, 1998