The authoritative version of this file is the one in the Scotty3D repository.

# A3: Path Tracing

In Assignment 3 you will write code to complete Scotty3D's high-quality path-tracing-based renderer. The first part of the assignment will focus on providing an efficient implementation of ray-scene geometry queries. In the second half of the assignment you will add the ability to simulate how light bounces around the scene, which will allow your renderer to synthesize much higher-quality images.

The assignment is split into seven tasks:

## Scoring

Total [100pts]:

• Checkpoint A3.0: [40pts]

• A3T1 Camera Rays [5pts]
• A3T2 Intersection Tests [14pts]
• ray vs sphere [6pts]
• ray vs triangle [8pts]
• A3T3 BVH [18pts]
• writeup-A3.txt [3pts]
• Checkpoint A3.5: [60pts]

• A3T4 Path Tracing [13pts]
• A3T5 Materials [13pts]
• A3T6 Direct Lighting [8pts]
• A3T7 Environment Lighting [13pts]
• writeup-A3.txt [3pts]
• render.s3d + render.png [10pts]

## Hand-in Instructions

To turn in your work, make sure you have all the files in the proper place and then run the following command in your root directory:

$tar cvzf handin.tgz src/ tests/a3/ writeup-A3.txt render.s3d render.png  Details: • We encourage you to develop your own test cases. Please include these in the tests/ folder. • If you do any extra credit that requires substantial refactoring (of the sort that might break tests), submit your code and write-up for the extra credit in a separate extra/ folder. • render.png and render.s3d are a cool scene you've assembled and rendered with Scotty3D • writeup-A3.txt is described below. ### Write-up You will submit a short document explaining how you believe your implementation performs on each of the tasks. The project directory contains a template in writeup-A3.txt. For each task, do either of the following: * If you believe that you have correctly implemented the required functions, simply leave the text "Fully implemented." * If your implementation does not fully function, write a short explanation of what your code can and cannot do, and (optionally) briefly explain your strategy and how you got stuck. If your explanation indicates significant understanding of the problem, we may award partial credit even though the code does not work. In addition, you will need to write a brief artists' statement for your render.s3d/render.png. ### Render Something With Your Code! It's very satisfying to see the images your code can make -- and the process of making something beautiful will encourage you to improve your code and fix bugs. So build some cool scenes and render them with your pathtracer! If you don't want to model things in Scotty3D, the "Import obj" button can help you import meshes from other programs (but please make sure you hold a license for the meshes you use). The most [Art Nouveau]https://en.wikipedia.org/wiki/Art_Nouveau)-styled render, as selected by the course staff, will be awarded a small prize. ## How to Test What You've Made Some basic (incomplete!) test cases have been provided for you. You should add and share your own test cases in the appropriate Piazza thread. #run all of the A2 test cases:$ ./Scotty3D --run-tests a2.


You can also edit meshes in the GUI, which provides functions to call your operators. If you find yourself performing the same edits over and over in the GUI, we suggest writing a test case instead.

Unfortunately, we don't provide a simple way to run mesh edits from the CLI.

## What To Do

Each task name is prefixed by a tag which you can use to locate and test the code. See Overview for a brief overview of relevant files. E.g., for "A3T1 Camera Rays" you can: - find where to fill in the code, by searching in src/ for A3T1. Helpful one-liner: find src -type f | xargs grep A3T1 - find the test cases in tests/a3/test.a3.t1.cpp - run the test cases with ./Scotty3d --run-tests a3.t1.

## Basic Visibility (Checkpoint A3.0)

See Camera Rays.

### A3T2 Intersections

See Intersections.

See BVH.

## Indirect Lighting (Checkpoint A3.5)

### A3T4 Path Tracing

See Path Tracing.

See Materials.

### A3T6 Direct Lighting

See Direct Lighting.

## Tips

Some suggestions which will make your A3 process easier.

There are some videos provided in the A3/videos folder - these videos were made several semesters ago and are slightly outdated, but many of the general concepts carry over.

### Dealing with Randomness

Path tracers are full of randomization. Debugging algorithms that depend on pseudo-random numbers can be difficult because every run is different.

Table of Content