Due Date

Tuesday April 2nd, 11:59pm

Overview

You will add additional features to your ray tracer from Project 3-1, including more complicated materials, environment lights, and depth of field effects. This project is of comparable size to 3-1, so plan accordingly and leave time for renders/writeup.

Project Parts

You'll also want to read these articles:

Getting Started

Accept the assignment through the link posted on piazza, and clone from your private repo using the command:

git clone <YOUR_PRIVATE_REPO>

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:

  • -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)

As well as two new keyboard commands:

  • k | l: Increase/Decrease the camera lens radius
  • ; | ': Increase/Decrease the focal distance

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 Previous Code

For Project 3-2, you will need a working implentation of Project 3-1. You have the option of either porting your code from Project 3-1, or using pre-compiled binaries generated from the staff solution.

Using Your Own 3-1 Code

To use your own code, set the build option BUILD_3-1 to ON in CMakeLists.txt. Then, you'll need to copy over the following files from your previous assignment, and place them in your src/ directory.

  • Part 1: triangle.cpp, sphere.cpp (place in src/static_scene directory)
  • Part 2: bvh.cpp, bbox.cpp

Additionally, you will have to copy specific functions from their old files in the previous assigment into part1_code.cpp:

  • From pathtracer.cpp
    • PathTracer::estimate_direct_lighting_hemisphere
    • PathTracer::estimate_direct_lighting_importance
    • PathTracer::zero_bounce_radiance
    • PathTracer::one_bounce_radiance
    • PathTracer::at_least_one_bounce_radiance
    • PathTracer::est_radiance_global_illumination
    • PathTracer::raytrace_pixel
  • From bsdf.cpp
    • DiffuseBSDF::sample_f
    • DiffuseBSDF::f
  • From camera.cpp
    • Camera::generate_ray

Using the Staff Library

To use the provided library, set the build option BUILD_3-1 to OFF in CMakeLists.txt. This will tell the generated makefiles to ignore part1_code.cpp, triangle.cpp, sphere.cpp, bvh.cpp, and bbox.cpp, and include the library that matches your system instead. Note that the staff binary will generate a small watermark on the corner of your image.

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!