Description

In this project, you will implement a basic ray tracer.

Code

Skeleton code is available here. This code contains a number of files, including.

The methods that you need to implement are marked with 'TODO' in the code. These can be found in boolean.cpp, camera.cpp, cylinder.cpp, phong_shader.cpp, plane.cpp, reflective_shader.cpp, render_world.cpp, and sphere.cpp. A code skeleton and driver framework is provided. You will need to implement object intersections, shading, and ray casting.

To run the tests, run ./ray_tracer <test-file>, where test-file is one of the provided test files. The tests can also be run with ./ray_tracer -p <test-file>, in which case the result is saved to output.png rather than rendered to the screen using OpenGL. The tests are designed to be implemented and debugged in order and are intended to help you debug your implementation. They will also be used for grading.

The code contains many comments explaining what needs to be done and what functions should do. Be sure to read through the code and comments before you begin implementing things.

Submission Instructions

You will submit your code as one file in one of these formats: tar, tar.gz, tar.bz2, or zip. Your submission should contain:

Extra Credit

Here are some ideas for extra credit:

You may also suggest another option by contacting the professor (by email or in office hours). In any case, you will need to explain briefly what you have done and how you did it (extra-notes.txt). The presence of extra-notes.txt indicates that extra credit has been done. For each file you add, briefly explain its purpose. For each file you modified, briefly explain why it was modified. Indicate which test cases are included, how to run them, and what we should see. No credit will be given for extra credit that is not demonstrated with at least two test cases, one of which should be nontrivial and challenging. Extra credit up to 10% of the total value of the project is possible. Changes made for extra credit should not alter the behavior of the original test cases.

Reference Renders

The table below documents the tests. Along with a thumbnail showing what the result should look like, I note some of the things we will be looking for in the test while grading. Click the thumbnail for a full-size image.

ThumbnailNotes
files/thumb-01.png 01.txt

5 points

Bare minimum to getting started: flat shading, sphere intersections, casting rays.
files/thumb-02.png 02.txt

5 points

Get the coordinate system oriented correctly, introduce colors.
files/thumb-03.png 03.txt

1 point

Test image size and camera settings.
files/thumb-04.png 04.txt

1 point

Test irregular camera orientation.
files/thumb-05.png 05.txt

1 point

Get basic plane intersections working.
files/thumb-06.png 06.txt

5 points

Add Phong shading and handle point lights.
files/thumb-07.png 07.txt

1 point

Add color to the lights.
files/thumb-08.png 08.txt

5 points

Add ambient lighting. Carefully test shading, paying careful attention to colors and subtleties of the highlights.
files/thumb-09.png 09.txt

5 points

Introduce basic shadows. This is also a bug test; there is a very bright light hidden under the ground.
files/thumb-10.png 10.txt

1 point

Bug test: objects behind the light.
files/thumb-11.png 11.txt

1 point

Bug test: object covering up the light. Since no light escapes, the image should be only contain ambient light.
files/thumb-12.png 12.txt

1 point

Start implementing Booleans: basic union.
files/thumb-13.png 13.txt

1 point

Start implementing Booleans: basic intersection.
files/thumb-14.png 14.txt

1 point

Start implementing Booleans: basic difference. Check to make sure that complex objects can cast shadows on themselves.
files/thumb-15.png 15.txt

1 point

Handle nesting of Booleans.
files/thumb-16.png 16.txt

1 point

Bug test: check complex interaction of Booleans.
files/thumb-17.png 17.txt

1 point

Bug test: check complex interaction of Booleans.
files/thumb-18.png 18.txt

1 point

Bug test: check complex interaction of Booleans.
files/thumb-19.png 19.txt

1 point

Bug test: check complex interaction of Booleans.
files/thumb-20.png 20.txt

1 point

Bug test: check complex interaction of Booleans.
files/thumb-21.png 21.txt

3 points

Add in support for cylinders. A reflective ground lets you see both ends.
files/thumb-22.png 22.txt

1 point

Check to make sure Booleans work with cylinders.
files/thumb-23.png 23.txt

1 point

Test recursion depth.
files/thumb-24.png 24.txt

1 point

Test recursion depth.
files/thumb-25.png 25.txt

1 point

Test recursion depth.
files/thumb-26.png 26.txt

1 point

Construct a bounded object from unbounded primitives.
files/thumb-27.png 27.txt

1 point

Complex Booleans and self-shadowing.
files/thumb-28.png 28.txt

1 point

Bug test: what happens if we construct a hollow piece of geometry and fill it with a camera, lights, and objects?

Grading script

As with the first project, we are providing you with the grading script that we will be using to grade this project. You can run it like this: "./grading-script.sh . grading-scheme.txt". The script works in the same way in the first project, although there are no timing tests with this project. There is a 10 second time limit on each test; this should be more than enough time for the tests provided. Be sure to test your project on one of the delta machines.

Note that extra credit projects will vary from student to student and are not graded using the script. These will be graded individually.

Checkpoints

This project has two checkpoints. These are milestones to encourage you to start your project early. At each checkpoint, you will submit your project just as you would when it is due. At the first checkpoint, your program will be graded out of 20 points. At the second checkpoint, your program will be graded out of 35 points. No extra credit is possible at checkpoints. When your project is due, it will be graded out of 50 points, and extra credit will be given for scores higher than that.