= Assignment 4: Investigating Importance Sampling = == Due: Tuesday May 16th, 11:59PM == Questions? Need help? Post them on the Assignment4Discussion page so everyone else can see! Please add a link to your final writeup on ["Assignment4Submission"]. Since there is very little coding to be done on this assignment, please give extra attention to the quality of the answers in your writeup. == Description == Rendering requires the computation of many different types of integrals. 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. 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. == Step 4: Multiple Importance Sampling == When computing the direct lighting for a given light, we use the Monte Carlo estimator to compute the integral of incoming radiance over all directions, weighted by the cosine of the angle between the ray direction and the surface normal. Depending on the distribution of the BSDF of the object surfaces and the direction function of the light source from the point being illuminated, it can be more efficient to sample the incoming direction from either of distributions. Pbrt combines the two sampling distributions by drawing samples from both distributions. This technique is called multiple importance sampling. 1) Read Section 15.4.1 on Multiple Importance Sampling. 2) Add a 'sample' option in 'directlighting' integrator. The possible values are 'bsdf', 'light', and 'mis'. It controls whether the samples are drawn from BSDF, light source, or both distributions. Set the default value to be 'mis'. 3) Render mis.pbrt with 3 options values. You should get images that similar to images on page 676 in the textbook. 4) Render killeroo_view1.pbrt with grace_latlong.exr as the environment map texture 8 light samples, BSDF distribution, 8 light samples, light source function, and 4 light samples, multiple importance sampling (MIS). 5) Compare the overall noises, parital noises on the glossy surfaces (i.e. the red killeroo and front two balls) and the diffuse surfaces among 3 images. Identify which image has the least amount of noise, and which one has the most. Explain the reason. 6) Explain why it is important to use half number of samples for MIS as 'bsdf' and 'light' sampling, in the comparison. == Step 5: Shortcoming of illuminated based sampling == So far, we have deomstrated using the intensity function of the environment map for importance sampling can significantly reduce the variance, using same number of light samples. Is this always true? Describe a situation that this sampling strategy may not be effective. Modify the killeroo scene or create a scene such that using 'infinitesample' light source produce an image with similar amount of noise as using lihgt source 'infinite.' Set the 'sample' option in step 4 to 'light,' how are the images affected? == Step 5: Short Questions == 1) Explain why for the same scene setup and same number of samples, the killeroo image with 'grace_latlong' environment map look more noisy than the one with the 'sunset' envrionment map.