Required Features for Ray Tracer Milestone 2
Ray Tracer Milesone 2
Due: Feb 20, 2024
In this second Milestone, you will implement faster handling of ray-object collision detection, and incorporate textures into your ray tracer. You will also implement some optional additional features of your choice.
There is no new starter code for this Milestone. Use the code you wrote in Milestone I as a starting point. You will not be re-penalized for broken Milestone I features when Milestone II is graded.
Fixing Bugs From Milestone I
You may correct errors in your Milestone I solution for 50% of points back on any Milestone I scenes that you previously failed. Do not submit a separate executable—we will simply rerun the Milestone I test scenes using your Milestone II code. Milestone I probably will not be graded in time for the Milestone II submission, but feel free to reach out to the TA for feedback on whether your Milestone 1 scenes are acceptable.
Required Features Do Not Sum To 100 Points
You can only earn 80% credit by completing the required features. To get full credit for this milestone, you must either implement additional optional features from the bells and chimes list, do well on the performance contest, submit a creative scene, or some combination of the three.
Required Features
(60 pts) Acceleration Structure
Implement your choice of a kD tree, bounding volume hierarchy (BVH), or octree to accelerate ray-object intersection.
Make sure that your acceleration module is able to handle the entire current set of geometric primitives – that is, triangles, spheres, squares, boxes, and cones.
(10 pts) Texture mapping
Implement texture mapping. To do this you will need to write code which looks up the texture color in the texture bitmap given the texture (u,v) coordinates during shading. Use a bilinear filter (bilinear interpolation) to compute the color “in between” texture pixels. The scenes provided in Public Scenes Part 2 contain texture-mapped examples.
More advance filter kernels, such as a sinc filter, are eligible for extra credit.
(10 pts) Cube mapping
Implement cube mapping (skybox) as a user-selectable option.
When using the cube map, rays that “go to infinity” look up their color in the cube map rather than using the default black color.
Use this feature to render the transparent dragon4.ray
with cube mapping.
A set of cube mapping textures can be loaded through the GUI, or the
command line option -c
. Note in either case you only need to specify one
texture file (any of the six works), and all the remaining files will be matched and
loaded automatically. For testing purpose, this function can be disabled in
GUI mode, by unchecking the Smart Load
checkbox.
Please note that the labeling convention for the cube map textures are the opposite of what you may expect; i.e. the +z
texture is the one to display when looking from the positive z
direction.
The required resources can be downloaded at the overview page.
Extra Credit
(up to 15 points) Performance Contest
During grading, the submission whose ray tracing code is the fastest will receive 15 points extra credit, and other high-efficiency submissions will receive partial extra credit. To measure rendering speed, a secret scene not included in the starter code (containing at least a few thousand triangles) will be traced using your code. The test will be performed using one ray per pixel (no anti-aliasing) and at least 5 levels of secondary ray recursion. The command line used for testing rendering speed looks like:
ray -r 5 [in.ray] [out.png]
Note: We may change the number of recursions, or add other standard arguments/options when testing our secret scenes.
Only ray tracers that correctly render the secret scene will be eligible for performance extra credit. You are welcome to use multiple threads when tracing rays. You are also welcome to precompute scene-specific acceleration structures when your program starts, and make other time-memory tradeoffs, but your precomputation time and memory use should be reasonable and will be included in the timing of your ray tracer. Don’t try to customize your ray tracer for the test scenes; we will use only the secret scene when running the performance contest.
If you have any questions about what constitutes a fair acceleration
technique, ask us. Compiling with optimization enabled is allowed (-O3
is already enabled, though).
Coding your inner loops in machine language is not allowed.
Using multiple computers or the cloud is not allowed. In general, don’t go
overboard tuning aspects of your system that aren’t related to tracing rays.
(up to 10 pts) Creative Scene
You may also include ray tracing scenes of your own; obviously, your ray tracer should be capable of rendering these scenes. Complex and creative scenes will receive more extra credit. Please carefully describe any scenes you want considered for extra credit in your README file.
Bells and Whistles
Many opportunities for additional credit are available for this project.
Important Any additional features you attempt must obey the following two cardinal rules:
-
Your code must obey the spec and the spec from Milestone 1. In other words, you can add new features, but should not modify the way that existing features function. You will be deducted points if your extra features causes your program to violate the spec!
-
Include a brief explanation of any scenes/features you would like considered for credit in your README file. This explanation must include instructions for turning on/toggling the extra features. Undocument or poorly-documented features risk receiving no credit.
-
Some of the following items presuppose a working implementation of the basic, required project features. You may not receive full credit for a bell or whistle if a dependent required feature is buggy or missing.
Approved 🔔 (10 pts each) and 🎐 (5 pts each)
-
🎐 Implement an adaptive termination criterion for tracing rays, based on ray contribution. Control the adaptation threshold with a slider.
-
🎐 Implement stochastic (jittered) supersampling. See Glassner, Chapter 5, Section 4.1 - 4.2 and the first 4 pages of Section 7.
-
🔔 Deal with overlapping objects intelligently. In class, we discussed how to handle refraction for non-overlapping objects in air. This approach breaks down when objects intersect or are wholly contained inside other objects. Add support to the refraction code for detecting this and handling it in a more realistic fashion. Note, however, that in the real world, objects can’t coexist in the same place at the same time. You will have to make assumptions as to how to choose the index of refraction in the overlapping space. Make those assumptions clear when demonstrating the results.
-
🔔 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 is a big win – nice antialiasing at low cost.
-
🔔 Debug the ray-cone intersection routine that was discovered to be buggy during Milestone 1 (it misses collisions). Demonstrate that your new code is correct by demonstrating the difference on a convincing array of test cases, and supply a patch that can be applied to the starter code to fix the bug.
-
🔔 Add some new types of geometry to the ray tracer. Consider implementing torii or general quadrics. Many other objects are possible here.
-
🔔 🎐 Implement bump mapping, normal mapping, displacement mapping, and/or parallax mapping.
-
🔔 🔔 for the first, 🔔 for each additional. Implement path tracing or stochastic ray tracing (a.k.a. distributed ray tracing) to produce one or more of the following effects:
- depth of field
- soft shadows from spot lights
- motion blur
- glossy reflection (See Glassner, chapter 5, or Foley, et al., 16.12.4).
-
🔔 🔔 Implement solid (volumetric) textures or some other form of procedural texture mapping, as described in Foley, et al., 20.1.2 and 20.8.3. Solid textures are a way to easily generate a semi-random texture like wood grain or marble.
-
🔔 🔔 Extend the ray-tracer to create Single Image Random Dot Stereograms (SIRDS), or 3D images for viewing with red-blue glasses.
-
🔔 🔔 Add support to the .ray file for basic animation, for example by allowing mathematical expressions as a function of time
t
anywhere a constant number could go. Add an option to your ray tracer to trace and output each frame of the animation sequence. For up to an additional 🔔 🔔, combine animations and add sound effects to create a compelling “ray tracing trailer” and post it to social media. The exact amount of credit will depend on the production values, editing quality, and technical ambition of the trailer. -
🔔 🔔 🔔 Train a neural network to upsample and/or antialias the ray traced output image. You should compare against and demonstrate a noticeable advantage over baseline, classical methods (such as simple Gaussian filters).
-
up to 🔔 🔔 🔔 🔔 Implement a more realistic shading model. Credit will vary depending on the sophistication of the model. A simple model factors in the Fresnel term to compute the amount of light reflected and transmitted at a perfect dielectric (e.g., glass). A more complex model incorporates the notion of a microfacet distribution to broaden the specular highlight. Accounting for the color dependence in the Fresnel term permits a more metallic appearance. Even better, include anisotropic reflections for a plane with parallel grains or a sphere with grains that follow the lines of latitude or longitude. Sources: Watt, Chapter 7, Foley et al, Section 16.7; Glassner, Chapter 4, Section 4; Ward’s SIGGRAPH ‘92 paper; Schlick’s Eurographics Rendering Workshop ‘93 paper.
-
This all sounds kind of complex, and the physics behind it is. But the coding doesn’t have to be. It can be worthwhile to look up one of these alternate models, since they do a much better job at surface shading. Be sure to demo the results in a way that makes the value added clear.
-
Theoretically, you could also invent new shading models. For instance, you could implement a less realistic model! Could you implement a shading model that produces something that looks like cel animation? Variable extra credit will be given for these “alternate” shading models.
-
🔔 🔔 🔔 🔔 Implement CSG, constructive solid geometry. This extension allows you to create very interesting models. See page 108 of Glassner for some implementation suggestions.
-
🔔 🔔 🔔 🔔 Add a particle systems simulation and renderer (Foley 20.5, Watt 17.7).
-
🔔 🔔 🔔 🔔 Implement caustics. Caustics are variations in light intensity caused by refractive focusing – everything from simple magnifying-glass points to the shifting patterns on the bottom of a swimming pool. Caustics may be implemented with Photon Mapping along with path tracing.
References
General
- An Improved Illumination Model for Shaded Display, T. Whitted, CACM, 1980, pp 343-349
- An Introduction to Ray Tracing, Andrew S. Glassner. (Chap. 6 for acceleration)
Space Subdivision
- Ray Tracing with the BSP Tree, K Sung & P. Shirley. Graphics Gems III.
- ARTS: Accelerated Ray-Tracing System, A. Fujimoto et. al. CG&A April 1986, pp. 16-25.
- A Fast Voxel Traversal Algorithm for Ray Tracing, J. Amanatides & A. Woo. Eurographics’87, pp. 3-9.
- Faster Ray Tracing Using Adaptive Grids, K. Klimaszewski & T. Sederberg. CG&A Jan. 1997, pp. 42-51.
Hierarchical Bounding Volume
- Automatic Creation of Object Hierarchies for Ray Tracing, J. Goldsmith & J. Salmon. CG&A May 1987, pp. 14-20.
- Efficiency Issues for Ray Tracing, B. Smits. Journal of Graphics Tools, Vol. 3, No. 2, pp. 1-14, 1998.
- Ray Tracing News, Vol. 10, No. 3.
Tips
- Fast Ray-Box Intersection, A. Wu Graphics Gems.
- Improved Ray Tagging for Voxel-Based Ray Tracing, D. Kirk & J. Arvo. Graphics Gems. II
- Rectangular Bounding Volumes for Popular Primitives, B. Trumbore. Graphics Gems. III
- A Linear-Time Simple Bounding Volumn Algorithm, X. Wu. Graphics Gems. III
- A Fast Alternative to Phong’s Specular Model, Christophe Schlick Graphics Gems IV.
- Voxel Traversal along a 3D Line, D. Cohen. Graphics Gems. IV.
- Faster Refraction Formula, and Transmission Color Filtering, Ray Tracing News, Vol. 10, No. 1.