Deadlines
Component | Deadline |
---|---|
Checkpoint Quiz | 03/21/2023 |
Assignment 3-2 | 03/24/2023 |
Project 3-2 is due Friday 03/24/2023, 11:59PM. You have a total of 5 slip days to use on assignments throughout the entire semester, but you do not have slip days for checkpoint quizzes. Assignments submitted after 11:59PM are considered as a full day late. There is no late minutes or late hours. After you have used all 5 slips days, you will lose 10% for each day you submit an assignment late.
Your final assignment submission must include both your final code and final write-up. Please consult this article on how to submit assignment for CS184.
Partners
You can optionally work with a partner on this project. If you work with a partner, both of you should join the same team on Github Classroom. You should also produce 1 writeup and 1 gradescope submission with the partner added on.
Checkpoint Quiz
The checkpoint quiz can be found on Gradescope and is intended to help you get started on Project 2. It is due Tuesday 03/21, 11:59PM PST. The content necessary for answering all questions can be found on the project spec or in lecture material. You will receive 5 "buffer points" for completing the quiz only if you answer at least 4 out of 7 questions correctly. These 5 buffer points will be added to your Project 3-2 grade, capped at increasing your score to 100. For example, if you earned 96 points on the base project and 2 points of extra credit, the 5 buffer points will bring your score up to 100, and the extra credit will bring your total score to 102.
You may change your answers after submitting, up until the deadline. No slip days may be used on checkpoint quizzes.
Project Parties
We will have three project parties for this project. Keep an eye on Piazza/the website calendar in case any of these need to change:
- Friday (3/17), 1-3pm: Berkeley Way West (BWW) Room 1213
- Wednesday (3/22), 7-9pm: Cory-400 Hughes Room
- Friday (3/24), 1-3pm: Berkeley Way West (BWW) Room 1213 (shared with Proj 4 due to overlap)
Writeup
We have separated writeup details into a separate article here.
Please feel free to use this writeup template!
Overview
In this project, you will add additional features to your ray tracer from Project 3-1, such as more complicated materials, environment lights, or depth of field effects.
NOTE: For this project, you will choose TWO out of the four given parts to complete. One of those parts must be Part 1 or Part 2. In other words, you can choose any combination of two parts except the pair (Part 3, Part 4).
This project will be shorter than 3-1, but rendering may still take some time. Please plan accordingly and leave time for renders/writeup. Start early!
Project Parts
Once again, you must choose TWO of the following parts, and one of those parts must be either Part 1 or Part 2. However, if you'd like to complete three, or all four parts, please do so! This project is one of the most rewarding to complete fully, as you'll be able to render almost anything at the end: all sorts of fancy materials in different environments, with any camera angle and focus depth.
- Part 1: Mirror and Glass Materials
- Part 2: Microfacet Material
- Part 3: Environment Light
- Part 4: Depth of Field
Other articles:
Getting Started
Accept the assignment through the website, and clone from your private repo using the command:
git clone <YOUR_PRIVATE_REPO>
As before, refer to this how to build cs184 projects document to build your project.
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)
Please consider using the CGL Vectors Library to write all your math computations to simplify your code & ensure correctness. You can read the documentation of this library here
A new mouse interaction:
- In render mode, after thin lens has been implemented, you can right click on a part of the image and automatically set the appropriate focal distance (autofocus). This is already done for people using pre-built binaries. For people using their own 3-1 code, you need to add this function to your pathtracer.cpp:
void PathTracer::autofocus(Vector2D loc) {
Ray r = camera->generate_ray(loc.x / sampleBuffer.w, loc.y / sampleBuffer.h);
Intersection isect;
bvh->intersect(r, &isect);
camera->focalDistance = isect.t;
}
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 the Staff Library (Default settings, Recommended)
The project has been configured to default to this settings. If you just cloned the repository, you can directly start building & writing code. You can also use this to check / compare your own project 3-1 solution.
To use the provided library, set the build option BUILD_CUSTOM to OFF (Default) in CMakeLists.txt. This will tell the generated makefiles to ignore your project 3-1 code, and include the library that matches your system instead. Note that the staff binary will generate a watermark on the corner of your image.
Using Your Own 3-1 Code
To use your own code, set the build option BUILD_CUSTOM 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.
- src/scene/sphere.cpp
- src/scene/triangle.cpp
- src/scene/light.cpp
- src/scene/bvh.cpp
- src/scene/bbox.cpp
- src/pathtracer/camera.cpp
- src/pathtracer/bsdf.cpp
- src/pathtracer/pathtracer.cpp
Additionally, you will need to delete all the functions under part 3-2 code in your bsdf.cpp. This includes functions:
Vector3D MirrorBSDF::f(const Vector3D &wo, const Vector3D &wi)
Vector3D MirrorBSDF::sample_f(const Vector3D &wo, Vector3D *wi, float *pdf)
Vector3D GlossyBSDF::f(const Vector3D &wo, const Vector3D &wi)
Vector3D GlossyBSDF::sample_f(const Vector3D &wo, Vector3D *wi, float *pdf)
Vector3D RefractionBSDF::f(const Vector3D &wo, const Vector3D &wi)
Vector3D RefractionBSDF::sample_f(const Vector3D &wo, Vector3D *wi, float *pdf)
Vector3D GlassBSDF::f(const Vector3D &wo, const Vector3D &wi)
Vector3D GlassBSDF::sample_f(const Vector3D &wo, Vector3D *wi, float *pdf)
void BSDF::reflect(const Vector3D &wo, Vector3D *wi)
bool BSDF::refract(const Vector3D &wo, Vector3D *wi, float ior)
Details
Do not convert or resize your .png. files. Use either the command line rendering mode or the S
key to save screenshots, not your own OS's utility (like Project 1 and 3-1 but not like Project 2). Keep your images in a subdirectory called images/
in the docs/
directory. We recommend using the -r 480 360
command line flag to set resolution at 480 by 360 for your screenshots.
Please also make sure that your writeup indicates clearly which two (or more!) parts you chose.
Final Note
As mentioned earlier, each of the parts of this project gives you something to work with, and if you finish all of Project 3-2, you can basically render anything. When you're done, feel free to show it off! Make some fancy scenes and materials, or play with the lens! Again, be creative!