The purpose of this assignment is to add support for direct lighting from area light sources to lrt. This involves integrating the reflection equation given the area light source. You will do this by Monte Carlo sampling. When you finish the assignment, you will be able to perform Monte Carlo integration for direct lighting in one of two ways:
You should also read the Chapters 9-13 in the
For extra credit, you should provide a third technique
This homework will be
graded according to the following system:
Copy the new version of lrt from
/usr/class/cs348b/software/lrt/lrt.tar.gz
to your directory.
The first thing you should implement is uniform area sampling.
You are asked to implement spherical lights. They are
assumed to be diffuse emitters. You have to figure out how to
generate uniform random samples (with respect to area)
given uniform random numbers. You also have to be able to return
a probability density function (pdf) for a given ray.
We have also provided stubs for cylinders and cones if you want
to try those (but that is not part of the assignment).
After getting the spherical light done, you should be able to code the
integrator to handle the case of evaluating a surface color based on
sampling the area light source. If you do this right, you should be
able to render a scene that has diffuse surfaces (implemented for
you) or Blinn glossy surfaces, multiple area lights, and some blockers
to produce something with soft shadows.
You should then implement sampling of glossy surfaces using the Blinn
microfacet distribution function. We know from class this is (N dot
H)^k. You will have to generate a random H vector based on the Blinn
distribution, then reflect your ray about this H to generate your
light vector. You'll also have to come up with a pdf for a point on the
surface.
After doing the Blinn surface, you should add the appropriate code to
the integrator and check to make sure everything works. You'll know
it is working if you can get some shiny surfaces.
If you have area lights and the Blinn glossy
surfaces working correctly, you may be ready to
tackle multiple importance sampling as extra credit. This part adds the last
bit of code to your integrator. Essentially this code will make use
of the sampling and pdf functions you've written, and will make better
decisions about what to do with each sample it is given.
Here is a skeleton test file: test1.rib.
There is a shiny metal surface and one spherical light source.
We will post some sample images soon ...
Copyright © 2001 Pat Hanrahan
If you decide to tackle the extra credit part of the
assignment, you will want to read:
Chapter 9 of Eric Veach's thesis.
Eric, a former graduate student
at Stanford, invented multiple importance sampling. I discussed
multiple importance sampling briefly in my
second lecture on Monte Carlo Techniques.
0 - Little or no work was done
* - Significant effort was put into the assignment, but not everything
works correctly.
** - Either the surface area or microfacet distribution sampling algorithm
(but not both) was functionally complete; it passed all of our tests.
*** - Both the area and the microfacet sampling algorithms worked
properly.
**** - The multiple importance sampling algorithm worked and passed our tests.
Note that this fourth star really is extra credit.
Setup
Coding
What to watch out for: Check to see what the fr() routine does to
make sure you provide it the correct values.
What to watch out for: Make sure your code handles shadows properly.
You should be able to generate soft shadows with nice penumbras.
You should check the shadows on and shadows off flags.
What to watch out for: Make sure your microfacet distribution
function is properly normalized, as was
derived in class.
Samples