Project 3-2: Ray Tracing Part 2

Due Date

Fri March 24th, 11:59pm


You will add more complicated materials, environment lights, and depth of field to your ray tracer

Project Parts

All parts are equally weighted at 25 points each, for a total of 100 points.

You'll also want to read these articles:

Using the program

Download the zipped assignment or clone it from Gitlab:

git clone

As before, use cmake and make inside a build/ directory to create the executable (how to build and submit).

Please consult the project 3-1 spec for details on the user interface. Here are some old and new command line flags you'll want to pay attention to:

  • -c cam_settings_file.txt loads a settings file that you dumped from the GUI using the d key (any part)
  • -e some_map.exr loads an environment light .exr image file (part 3)
  • -b 1.23 sets the lens radius to 1.23 (part 4)
  • -d 4.56 sets the focal distance to 4.56 (part 4)

Also please use the "cell render" mode to debug, where you can interactively click and drag to select a small region of the screen to be rendered. Press c (after pressing r) to toggle this mode in the GUI.

Integrating the new code

In order to get this new version of pathtracer up and running, you will need to copy over the version of these files you filled in for your previous assignment (make sure you copy the entire file):

  • Part 1: triangle.cpp, sphere.cpp
  • Part 2: bvh.cpp, bvh.h, bbox.cpp

Additionally, you will have to copy these specific functions into the new pathtracer.cpp file:

  • PathTracer::estimate_direct_illumination
  • PathTracer::estimate_indirect_illumination
  • PathTracer::raytrace_pixel

and these functions into bsdf.cpp

  • DiffuseBSDF::sample_f
  • DiffuseBSDF::f

and this function into camera.cpp

  • Camera::generate_ray

Do not overwrite the rest of these three files!

Rendering Competition Part 2

If you participate in this assignment's rendering competition, we will require you to submit both a competition.[png/mov/webm/mp4/etc.] image or video and a short 5-10 sentence description of what you did to create your entry. You can choose to either emphasize the technical or artistic/modeling merits of your image. If you go the artistic route, you should generate the model yourself using Blender or procedural code that you write. If you go the technical route, you may use models downloaded from the internet, but you should emphasize the extra algorithms you implemented in your short writeup.

Final Note

When you finish Project 3-2, you can basically render anything, so show it off! Make some fancy scenes and materials, and play with the lens! Again, be creative!