Wineglass

CS348B Final Project

Jeff Brasket, Michael deLeon


 

Out final rendered image (top left) vs. our target photograph
... click here for 800x800 resolution
 

Motivation

For our final project, we wanted to experiment with an image that would showcase caustics as portrayed by photon mapping.  Searching the internet, we started thinking about wineglasses.  We found an interesting mix of images from wineries in outdoor settings and a fair number of unrealistic wineglass images scattered across the web from various past projects.  We decided we wanted to make a very realistic looking wineglass illuminated by an outdoor scene.  See our proposal for more about our inspiration.

We wanted to include an outdoor photograph for our backdrop, so our wineglass should have to look very convinving to stand up to this comparison.
 

Photon Mapping

The most challenging part of our project involved implementing the photon mapping algorithm as explained in Henrik Wann Jenson's excellent book, Realistic Image Synthesis Using Photon Mapping.  After developing a general global photon map and a way of "painting" dots to demonstrate the placement of photons, we next worked on a separate caustic photon map to increase the resolution of the caustics generated by the glass that would be the centerpiece of our image.  We did render a few Cornell Box-like test images to make sure our algorithm was working correctly.  We also ended up finding a fiar amount of bugs in the LRT Path Tracing integrator in the process of exploring diffuse reflections with this box.  We later realized that these diffuse reflections would add little to our particualr schene, and so built a modified Whittig ray tracer with photon mapping activated under the Monte Carlo heading to enable us to call either from RIB files.

Our final caustic map can be targeted using one or two ciircles specified in the photon mapping code.  Samples are regularly generated over this area, bounced around according to a russian roulette system, and then stored in Jenson's photon map data structure.  For the caustic photon map, we ony store photons from this target that hit specular surfaces on the first bounce.  This gives us an excellent sample of the caustic genreating photons.  Eventually, we also used the cognac glass data from Jensen's book make sure our glass model and photon map systems were working correctly.

testing our photon model with the cognac data ...
 

NURBS

We decided to model our wineglass in Maya and exported it to the RIB format.  Past projects told us this would be a challenge, but possible.  We had the most luck exporting revovled surfaces to the RIB format using a standard Maya plugin and then using only the NuCurve information in our RIB files.  We seperated the wine surface and wine/glass interfaces into distinct revovled surfaces, and even seperated the base and glass upper lip so that we could improve resolution in these areas when refining the NURBS surfaces.  The NURBS support in LRT seemed to work pretty well, though we added the ability to interpolate normals, gererating a normal for each vertex directly from the NURBS curves and storing them for interpolation during the resulting triangle mesh refinement.  This gave us a very smooth, realistic glass appearance.  We tried several iterations of our wineglass model before yielding one that looked very close to our example glass.

     
Earlier versions .. a non-interpolated, fine mesh glass (left) and early table texture attempts with thick-walled glass model.
 

Modeling Glass


We started our glass simulation by implementing the Fresnel equation for glass reflection and transparency as described in lecture.  We experimented carefully with indexes of reflection to model the glass and wine differently, and used the ratio of the two to get the interface right with LRT.  We also experimented briefly with a normal map to simulate minor imperfectiosn in glass thickness and smoothness, but did not have time to get this looking realistic.
 

Backgrounds


We took several reference images using a diginal camera, including target photos of wineglasses under various sunlight conditions.  We also took extra background images to use with our rendered image.  We even used a silver ball to attempt environment mapping.  With a little creative placement of these images all around our subject and careful lighting placement, we were able to effective recreate our scene conditions under all transmission and refelctions directions in our glass.  We used a silver ball and glass sphere as test objects to make sure all directions were decently represented in our test image.  We also took time to accurately model a table surface for our glass with a realistic texture pulled from a Pergo web page and dailed in for proper illumination.

Results

We were very happy with our results.  Many folks have trouble distinguising between our image and the photo that inspired it.  We used a final photon map of about 200,000 photons and a rendering sampling of 16 rays per pixel to eliminate aliasing.  Although our methods were fairly straightforward, we think we showed that very realistic images are possible using basic but well implemented ray tracing techniques.
 


An image with red wine and a different viewing angle