Project 2

[Logo]

Project 2: Acceleration Structures


Project Description

You will extend your ray tracer to include an acceleration structure.

Getting Started

You will begin with the code from your previous assignment. If you have not completed this assignment, you can complete the missing features during this assignment for some points back.

Required Functionality

  1. Implement anti-aliasing. Regular super-sampling is acceptable, more advanced anti-aliasing will be considered as an extension.
  2. Implement a spatial data structure, either a k-d tree or a bounding volume hierarchy, to speed up the intersection computations in large scenes.

Anti-aliasing

Once you've implemented the shading model and can generate images, you will notice that the images you generated are filled with "jaggies". You should implement anti-aliasing by super-sampling and averaging down. You should provide a slider and an option to control the number of samples per pixel (1, 4, 9 or 16 samples). You need only implement a box filter for the averaging down step. More sophisticated anti-aliasing methods are left as bells and whistles below.

Accelerated ray-surface intersection

The goal of this portion of the assignment is to speed up the ray-surface intersection module in your ray tracer. In particular, we want you to improve the running time of the program when ray tracing complex scenes containing large numbers of objects (they are usually triangles) by reducing the number of ray-object intersection tests using a spatial data structure. Use either a k-d tree or a bounding volume hierarchy (BVH), they are very similar and quite effective as described in class.

The sample scenes include several simple scenes and three complex test scenes: trimesh1, trimesh2, and trimesh3. You will notice that trimesh1 has per-vertex normals and materials, and trimesh2 has per-vertex materials but not normals. Per-vertex normals and materials imply interpolation of these quantities at the current ray-triangle intersection point (using barycentric coordinates).

Note that you will need to handle all scene geometry including Trimeshes. Due to implementation details, it might be easier to implement a spatial data structure for the scene then individual data structures for each of the Trimeshes to handle TrimeshFaces.

Submission Instructions

Submit your project via GitLab and provide a link to it via Canvas. Make sure to keep your repository private and give access to me (thesharkcs) and the TA (TA GitLab usernames are posted to Announcements on Canvas). We will be grading based on a branch called code-freeze, so please make sure you have a working final version of the project on that branch. You may also include missing features from your previous assignment in this project to receive some back credit on Project 1.

In addition to the code, please include:

If commits are made after the deadline, we will treat that as a late submission, and we will deduct late slips accordingly and/or apply the late submission penalty as per the syllabus.

As always, make sure you do not include any extraneous files (i.e. intermediate objects etc) in your repository before submitting.

Notes on Grading

You'll be graded on how well you met the requirements of the assignment. D quality or below work has few or none of the features implemented/working. C quality work has implemented some or most of the features, but the features are built in a way that is not fully working and/or the logic is not well-considered. B quality work has implemented most or all of the features in a way that works but may have some issues and/or the logic is not fully considered. A quality work has implemented all of the features in robust, polished way that demonstrates your understanding of the assignment, the math, and the provided code base. Note that a well-written report can help us understand your thought process, which is a large part of what we are grading you on in these assignments.

For grading on the rendering speed, the scenes will be traced at the specific size with one ray traced per pixel, and the rays should be traced with 5 levels of recursion, i.e. each ray should bounce 5 times. If during these bounces you strike surfaces with a zero specular reflectance and zero refraction, stop there. At each bounce, rays should be traced to all light sources, including shadow testing. The command line for testing rendering speed looks like: ray -w 400 -r 5 [in.ray] [out.bmp]. Be sure to enable your acceleration structure when the program is invoked from the command line. Don't try to customize your ray tracer for the test scenes; we will also use other scenes during grading. All timing will be done on departmental lab Linux machines, another reason why you need to port and test your code on those machines if you develop on another platform.

You should not worry too much about optimizing your code (i.e. there's no need to build out extensive threading models on top of the spatial partition structure), but speed is part of this assignment, so make sure you're implementing features in a way that considers good runtime efficiency. If you'd like to include a discussion of your algorithm's Big O time bounds and/or empirical benchmarking in your report, we will use that in our evaluation as well.

Approved Bells and Whistles

[whistle] Implement stochastic (jittered) supersampling. See Glassner, Chapter 5, Section 4.1 - 4.2 and the first 4 pages of Section 7.

[bell] Implement antialiasing by adaptive supersampling, as described in Glassner, Chapter 1, Section 4.5 and Figure 19 or in Foley, et al., 15.10.4. For full credit, you must show some sort of visualization of the sampling pattern that results. For example, you could create another image where each pixel is given an intensity proportional to the number of rays used to calculate the color of the corresponding pixel in the ray traced image. Implementing this bell/whistle is a big win -- nice antialiasing at low cost.

References


Last modified: 09/11/16 by Don Fussell fussell@cs.utexas.edu