Lab 1
to learn about ray intersection and space partition techniques
Due: Monday, October 31, 2016 at 23:59
Start Early!!!
This lab was modeled after the exercise 4.1 and 4.2 of the pbrt book.
- Individual Effort:
- No team participation is really encouraged in the case of the
homework or the labs.
Academic Misconduct
- Late Submission:
- In general late submission is not encouraged/accepted unless
there is a very good reason. You are encouraged to submit on time. We are on a tight schedule. Being late for one lab could affect the time left for you to complete subsequent labs. Late Submissions are possible, yet they will be penalized.
- One day late: 15% penalty
- Two days late: 30% penalty
- Three days late: 50% penalty
- Four or more days late: 100% penalty.
Objectives
The goal of this assignment is two-fold. At first, you are to reason about
the pros and cons of the ray-tracing acceleration structures that pbrt has
implemented. In that part of the lab, you will get to know the scene description files of pbrt and do not have to modify the code at all. In the second part, however, you are to improve the grid acceleration structure of pbrt and evaluate how much performance improvements you get.
Step 1: Understand pbrt's implementations of the grid accelerator
It is critical that you first obtain a detailed understanding of pbrt's grid accelerator. Read Section 4.3 of the textbook and make sure you can follow the code in
grid.cpp, located in the
accelerators directory of the code base. Include the answers to the following questions about the current implementation in your writeup.
- What heuristic is being used in determining the size of the grid?
- What are scene files that would really benefit from this heuristic (best case scenario)?
- What are scene files, that do not perform very well under this heuristic?
- Provide one scene file each for the best and worst case scenario, and provide a performance table with rendering times with and without the grid accelerator enabled.
Step 2: Understand pbrt's implementations of the BVH accelerator
It is critical that you first obtain a detailed understanding of pbrt's BVH accelerator. Read Section 4.4 of the textbook and make sure you can follow the code in
bvh.cpp, located in the
accelerators directory of the code base. Include the answers to the following questions about the current implementation in your writeup.
- What heuristic(s) is being used in determining the splitting criteria?
- What are scene files that would really benefit from this heuristic (best case scenario)?
- What are scene files, that do not perform very well under this heuristic?
- Provide one scene file each for the best and worst case scenario, and provide a performance table with rendering times with and without the grid accelerator enabled.
Step 3: Background reading
Read the paper
"Grid Creation Strategies for Efficient Ray Tracing" by Thiago Ize, Peter Shirley, and Steven Parker. Include the answers to the following questions in your writeup.
- What is a two-level grid?
- What is the basis of the simple heuristic for the grid accelerator in pbrt?
- How can you improve it using a two-level grid?
Step 4: Implement a two-level grid accelerator
Modify grid.cpp so that the grid accelerator uses a two-level grid using the heuristics as explained in the paper by Ize et al. Be sure to keep a copy of the original grid accelerator implementation around for use in later assignments and for debugging and test in this assignment. (Alternatively, you may want to implement your two-level grid accelerator as a new class in pbrt. This will require modification of the pbrt project/Makefiles, and some of the surrounding pbrt code, but would allow you to select between your and the original grid implementation by only changing the scene file, not recompiling the grid accelerator module. Mike showed how to do this.).
Debugging suggestions
Step 5: Evaluation
Understand the performance gains of your implementation.
- Measure the trade-offs related to time spent building the grid, memory used to represent the grid, and time needed to find ray-object intersections for different grid resolutions.
- Create a table and test all the scenes you created for (i) the grid accelerator, (ii) BVH, (iii) kd-trees, as well as (iv) your new two-level grid accelerator.
building time
The rendering time reported by pbrt does not include the time spent building the acceleration structure. Use the ProgressReporter class to measure the amount of time it takes pbrt to create a grid (see the CreateGridAccelerator function in grid.cpp. Modify the code to time the creation of the GridAccel like this:
ProgressReporter progress(1, "Building twoLevelGrid");
GridAccel* accel = new GridAccel(prims, refineImmediately);
progress.Update();
progress.Done();
Step 6: Submission
Be sure to double check your final submission by unzipping it in another directory on a computer in the PC LAB and testing it. (Especially for last minute submissions.) A project that doesn't run will lose more points than one that is one day late. Be sure to submit any comments or remarks in a 'readme.txt' file.
Submit your files at Moodle
here.
Your submission should contain:
-
Include one paragraph about the estimated effort you put into this lab.
How many (focused) hours of work did it take you and roughly where did you spend
most of your time.
-
Answers to questions from steps 1, 2 and 3, and evaluation results and discussion from step 5 in a report prepared in pdf or html format.
-
The images you rendered in the steps above, clearly labeled, attached and embedded in your report as well as original files (including the scene files). You should render all these images in PNG format at a resolution of 400x400, with at least 4 samples per pixel.
-
Your code (grid.cpp and all other files you added or modified). It must compile using a simple 'make' command on the computers in the student computer labs. Please include a 'readme.txt' file if you need to point out any special considerations.
All files should be contained in a single ZIP file. Make sure your code, images, and report, are contained in their own, separate folders within the ZIP file.
We expect a good student to have to work approximately 15 hours on this assignment.
Grading
This assignment is extremely open ended, and there are many ways to correctly implement the assignment. In addition to the correctness of your code, your grade will depend largely on your ability to describe the strategies you tried and your evaluation of them on the test scene.
This assignment (as well as all future assignments in the class) will be graded on a 4 point scale:
- 1 point: Finding good scenes for step 1 or 2.
- 2 points: Finding good scenes for step 1 AND 2.
- 3 points: Functional implementation of two-level grid in addition to having good scenes for 1+2.
- 4 points: Functional implementation of two-level grid. Writeup is minimal.
- 5 points: Completion of all requirements for 4 points as well as a clear writeup of answers to the questions in steps 1, 2, and 3, and addressing points discussed in step 5.
- Optional: Extra credit will be given for implementing an optimized hierarchical grid, exceptional experimentation with heuristics, or other techniques to improve the performance or quality of your multi-level grid implementation.
NOTE:
We will NOT (under any circumstance) accept labs that only run under
windows or have porting problems. You are on your own, if you use
windows to develop your labs. There will be absolutely NO exceptions.
Academic Honesty