CS 563: Advanced Computer Graphics
Assignment 3: Importance Sampling
Due: Tuesday, April 3
Description
The focus of this assignment is efficient rendering with complex illumination, such as the natural environment lighting in the above images. Rendering from these representations requires that we approximate the integral over all lighting directions for every image sample. Therefore, high variance in the illumination can lead to noisy images, since it is possible to underestimate the integral by failing to sample small, bright regions in the environment map. One solution is to sample the illumination such that bright areas are more likely to be sampled than dark areas. This technique is called importance sampling, because it assigns greater importance to certain sample points over others. For this assignment you will improve pbrt's support for rendering from environment maps by importance sampling the illumination.
Step 1 (Theory)
Read the paper draft Monte Carlo Rendering with Natural Illumination, which describes in detail importance sampling algorithm you need to implement. You should be comfortable with the concepts before you attempt to write any code for this assignment. Also, you may want to [re]read the monte carlo chapters in the pbrt book.
Step 2 (Implementation)
Download this zip file containing the skeleton code and scene descriptions you will need for this assignment. This files contains a plugin stub (envlight.cpp), binary for a reference implementation, example images, and a VS2003 project for the EnvironmentLight source model you will use to implement importance sampling. The scenes folder contains several pbrt scene files along with environment maps for indoor and outdoor illumination. You should use low (2-4) image and light sampling rates for development and debugging, since this will speed up rendering significantly and still reveal the type of problem you are dealing with in this assignment: noise reduction.
- pbrt assumes environment maps use a latitude-longitude parameterization. The images we provide have this format, so make sure you convert to the same if you want to try using other environment maps. You can covert from various other parameterizations using the panoramic transformations in HDRShop. Also, Paul Debevec's website is good resource for all things related to image-based lighting, and there you can also find more environment maps.
- One easy way to debug your implementation and test things incrementally is to make sure your discrete probability density functions are normalized. In other words, check that your joint and marginal densities sum to one.
- You should use the InfiniteArea light source to render images with random light samples. See the pbrt scene files (or book) for examples of how to use this light source. The EnvironmentLight is based on this model and therefore has the same declaration fields. You only need to change the field from "infinite" to "envlight" to use your importance sampling implementation.
- As a general rule, use only the paper draft and the pbrt book as references for this assignment. Do not copy importance sampling code from the internet.
Step 3 (Results)
Importance sampling the illumination allows us to generate high-quality images using much lower sampling rates than you would need with random sampling. For example, the above images were rendered with the same sampling rate (16 light samples), with random sampling (left) and importance sampling (right). For part 3 of this assignment you will demonstrate the effectiveness of your importance sampling implementation by rendering images with environment map lighting. For each scene, you will vary the sampling rate and compare images with and without importance sampling. Use 300 x 300 image resolution and 8 image samples for all renderings, both random and importance sampled lighting. Specifically, you are required to render the following scenes for comparison:
- killeroo-grace.pbrt: Use light sample numbers of [2,4,8,16,32].
- killeroo-stpeters.pbrt: Use light sample numbers of [8,16,32,64].
- killeroo-rnl.pbrt: Use light sample numbers of [2,4,8,16].
- spheres-grace.pbrt: Use light sample numbers of [32,64].
Submission
Write a short web page describing the algorithms you implemented for importance sampling. Email me the URL of this web page as usual. The web page should consist of a link to your code and images comparing random and importance sampling for the scenes and sampling rates listed in step 3.
This project was adapted from CS 551/651 from University of Virginia, spring 2005