CS 6620: Advanced Rendering (Spring 2009)

Instructor: Kavita Bala 

Homework 2: Monte-Carlo Rendering I (Direct Illumination and Shading)

Due Friday, March 13 2009, 11:59 pm

Do this assignment in groups of 2


Refer to the FAQ page for updates.

1. Ray tracing with shaders

Using the provided ray-tracing code, implement the following: extend your ray tracer to include pixel anti-aliasing, using Monte Carlo sampling.

  1. Add a method to your Camera class called setPixelRaysPerPoint(int numSamples).  This is the number of rays you will shoot through each pixel. Use a box filter to compute the weighted average of the pixel samples.
  2. Add a method to your Camera class called setPixelRaySamplingMethod(String method)
    1. If method is "uniform" then pick the rays uniformly over the pixel
    2. If method is "stratified" then subdivide the pixel into bins and shoot one ray randomly within each bin. Have the same number of bins horizontally and vertically and make the number of bins be as close as possible to the number of pixel rays per point.

2. Shading models

For this part of the assignment you can assume that the light sources you will have to deal with are small spherical lights. With a small light, you can assume that visibility and emission will remain constant over the solid angle subtended by the light source. First add support for the following materials:

  1. Emissive

  2. Lambertian

  3. Modified Blinn-Phong

  4. Cook-Torrance

  5. Isotropic Ward

For this question you should not compute the contribution from indirect lighting (that is, light that bounces more than once before it reaches the eye) in this assignment. Thus, you should not see reflections of objects other than light sources in materials.

Sample model files has been provided and you will receive a few more later. If you use our code, your submitted code will be run like this:

java -cp submission.jar;vecmath.jar cs6620.RayTracer model.xml

If you turn in your own framework you will need to give us detailed instructions on how to run.

3. Direct Illumination

Extend your ray tracer to perform area sampling on light sources:  Add a method to your Camera class called setDirectIlluminationOnly (String state). If state is "on", direct illumination only is evaluated. If state is "off", both direct and indirect illumination (next homework) will be evaluated.

  1. Sampling light sources: You can no longer assume that the light sources will be small spheres. The light sources can be of any size and will be either spheres or triangles. The Global Illumination Compendium contains a method for generating uniform random samples on a triangle. 
  2. Add a method to your Camera class called setShadowRaysPerPoint(int numShadowRays). This will be the total number of shadow rays cast to all the light sources at each point at which you cast shadow rays. For example, if you had 10 light sources and shadowRaysPerPoint was 30, you would shoot on average 3 rays per light (assuming you uniformly sample the light sources). If shadowRaysPerPoint was 1, one of the light sources would be picked at random at each point and have a shadow ray cast at it. This approach makes the cost of shadow rays constant regardless of the number of lights in the scene. The default value for this parameter is 1. Add a method to your Camera class called setShadowRaySamplingMethod(String method)
    1. If method is "uniform" then each light in the scene should get the same number of shadow rays on average. 
    2. If method is "area", the probability of a light having a shadow ray cast to it should be proportional to its area. The total number of shadow rays shot per point should still be the number specified by shadowRaysPerPoint.
    3. If method is "power", the probability of a light having a shadow ray cast to it should be proportional to its power. The total number of shadow rays shot per point should still be the number specified by shadowRaysPerPoint.

Hints:

Submission instructions:

Submit this assignment through CMS. You should submit one result image produced by your ray tracer for each of the test scenes provided. The image should have a name corresponding to the scene used to create it (e.g. scene1.png for scene1.xml).

Page maintained by Kavita Bala