Motivation

In the past assignment you wrote code for a ray casting system capable of rendering the scenes described in the driver files. In this assignment you will be adding to your existing ray tracing software a capability to perform reflection i.e., recursive ray tracing. This will include the ability to control the depth of recursion though your driver files. Moreover, your code should also be able to "smooth" the cow.

Data Formats

The driver file used here is identical in format to that used in the previous assignment with two exceptions. There is a new field specifying the recursion depth, e.g., recursionLevel 3 . As in the SageMath notebooks, a recursion level of zero means there will be no recursive ray tracing performed and your code will revert to ray-casting as in the previous assignment. The second change is one additional argument just before the name of an obj file. The two options are sharp and smooth . Examples of both are included in the driver files for this assignment.

Task

In this assignment your code will be responsible for correctly rendering four scenes, three of which are described in the driver files given to you in the drivers_models.zip file provided below and the other will be of your choice while adhering to the guidelines described below.

An important part of the assignment is for you to demonstrate a hands-on understanding of how to create a scene. In turn, a big part of what makes your new scenes interesting will be in the interaction of objects through reflections and shadows. To accomplish this assignment there are two principle tasks:

  1. Implement a recursive ray tracer. For details of how this should be done, please use the Sage Notebook illustrations presented in lecture. You are also being asked to design a visually interesting scene where evidence of recursion is clearly visible. At a minimum, somewhere in the scene a viewer should see clearly that some object A is reflected in a second object B that is in turn reflected in an object C.
  2. Write code that performs soothing as discussed in the class. To summarize the discussion from class. You will need to determine for each vertex which faces share this vertex. Now. for a specific triangle, look up the faces that share that vertex. If the true normal for the vertex you are processing is close enough in orientation to that for an adjoining face, then add its true normal to a running average of normals. Repeat this process for all three vertices of the triangle containing the surface point you are illuminating. Next, interpolate between these smoothed normals using the beta and gamma values calculated when you performed the ray triangle intersection. This approach was discussed in lecture on November 1 in connection with slide 15. It may help to review in the video that discussion.

In this assignment your code will be responsible for correctly rendering four scenes, three of which are described in the driver files given to you in the .zip below and the other one will of your choice while adhering to the guidelines described below.

Scene 0:
The scene described in driver00.txt
Scene 1:
The scene described in driver01.txt
Scene 2:
The scene described in driver02.txt
Scene 3 (name it driver03.txt):
Construct a scene involving at least two spheres and at least one .obj model. Light this scene using at least two point light sources. Use a recursion level of 5. Demonstrate that your code properly handles shadows, smoothing, and reflections in the scene.
As before, your rendered image should be written to disk as an image file in PPM format (see Assignment 2 for details on PPM format). Here are the example ppm outputs for the three driver files. Note that your ppms may not exactly match with these examples. [These examples are available now.]

Your program will take two command line arguments. The first argument is a driver file. The second argument is name of the image your program will write back to disk in the same folder where your executable is located. A C++ example is:

$./raytracer driver00.txt driver00.ppm

Submission

Submit a tar file via the CANVAS assignment page that includes:

  • Driver files (driver03.txt) and model files necessary to demonstrate scene 3.
  • PPM files generated for driver03.txt
  • Your source files
  • Libraries if you use any
  • A makefile if appropriate
  • README.txt file that explicitly contains (1) A command to compile your program and (2) A command to execute it.

If you are using C++, your executable should be named 'raytracer'. If your are using java, the main executable class should be named 'Raytracer'. Notice the change in case for the first letter between C++ and Java. It is must for this assignment to take exactly two arguments as described above.

Reminder

There is no “late period”. It is essential to start earlier and finish earlier. The program is due when it is due. All work you submit must be your own. You may not copy code from colleagues or the web or anywhere else. Cheating will not be tolerated, and will be handled in accordance with university and department policy.

Addendum (Last update: 11/04/2018 by Guru)

-Updated driver02.txt in drivers_models.zip

-scene_ppms.zip is available now

Addendum (Last update: 11/06/2018 by Guru)

-Updated driver00.ppm and driver00.txt in scene_ppms.zip and drivers_models.zip, download the latest versions

Addendum (Last update: 12/01/2018 Guru)

Here are the unkown test cases test_cases.zip