Assignment 4: Investigating Importance Sampling
Due: Friday May 18th, 11:59PM
Please add a link to your final writeup on Assignment4Writeups.
Rendering requires the computation of many different types of integrals. For example, in the last assignment we numerically integrated over the back element of the realistic camera lens to compute the irradiance indicent on each pixel of the camera's film. In this assignment integration is performed over the directions subtended by area and environmental light sources. As you are now well aware, the variance of a monte carlo estimator manifests itself as noise in a rendered image. Thus, when integrating a function, it is important to choose samples from the domain of integration such that variance in the integral estimate is minimized. Importance sampling is a variance reduction technique that draws samples using a distribution that is proportional to the value of the function over the domain. In this assignment you will explore various approaches for sampling irradiance on scene objects due to an infinite area light source (environment light) and explain when certain approaches are preferrable to others.
We are happy to inform you that this assignment is designed to be significantly shorter than Homework 2 and 3.
Step 1: Background Reading
Read chapters 13 (especially 13.5), 14 (especially 14.3.4) and 15 (especially 15.6) in the pbrt book. This assignment will require a solid understanding of importance sampling, so please read the these chapters carefully.
Additionally, you may want to take a closer look at the Monte Carlo integration your performed in assignment 3. Read this document to see why.
Notice that there is a typo in the MULTIPLE IMPORTANCE SAMPLING EQUATION on pbrt page 676. The pbrt code core/transport.cpp is correct, the equation in the book is wrong. Instead of multiplying both summations by the factor 1/(nf + ng) as given in the book, the first summation (sum over samples drawn from a pdf from f) should be scaled by 1/nf. The second summation should be scaled by 1/ng. A correction is posted on the pbrt Errata page.
Step 2: Importance Sampling an Infinite Area Light
In the scenes we've rendered in this class so far, objects were lit using a small number of spotlight or area light sources. In the real world, light incident on an object comes not just from light emitters, but from all directions. One way of approximating this effect in pbrt is to use an environment light (infinite area light in pbrt), which is used to define light entering the scene from all directions due the surrounding environment. Environment lighting can greatly contribute to the realism and richness of your renderings, however, since computing environment lighting involves integrating incoming radiance over the entire hemisphere above a surface normal, in the worst case, Monte Carlo estimates are prone to be noisy, and require many samples to produce images of reasonable quality. In the scene below, images of the killeroo scene are rendered with 4, 8, and 128 samples per pixel.
Importance sampling the environment map can make an enormous difference in the quality of the rendered image. Both images below are rendered using the same number of samples. In the image below at left, samples are drawn from a cosine-weighted distribution centered about the normal of the surface being shaded (see lights/infinite.cpp). However, in the case of an infinite area light, we know the light's luminance ahead of time, and therefore we can use this information to perform better sampling. At right, samples are drawn using a distribution that is proportional to the luminance of the environment map (see lights/infinitesample.cpp).