In the first assignment, you wrote code to read and manipulate 3D models in .obj format. In the second assignment, you wrote code to ray trace spheres with ambient and diffuse lighting. In this assignment, you will combine those and implement three more features in your ray tracer:
The driver files used for this assignment are the same as in previous assignments with the following modifications:
recursionlevel 3
. As in the SageMath notebooks, a recursion level of zero corresponds to no
recursive ray tracing, like the second assignment.
model wx wy wz theta scale tx ty tz model.obj
), and the same transformations must be done to transform
the model's position into world coordinates.mltlib file_name
, where file_name
is a .mtl file as described on
Wikipedia and in lecture.
The .obj file will also have lines such as usemtl shinyred
that signify all faces after that line and before the next
usemtl line should use the specified material in the .mtl file. For our purposes, we will currently only consider the
Ka (ambient), Kd (diffuse), Ks (specular), Ns (specular exponent), and illum (illumination model) values. Ka, Kd, and Ks specify
the reflectivity of the object for each kind of lighting, much as with spheres. Ns specifies the specular exponent, as discussed in lecture.
The illum value is used for determining if a model is "mirror-like" in its reflection. The only illum values we will consider currently are 2 (no mirror-like reflection) and
3 (mirror-like reflection with Kr=Ks). More will be said about these material files in lecture.This assignment intentionally combines the previous two assignments and builds from them. It is recommended that as you complete this assignment, you simplify and improve your code where possible to make these and upcoming changes easier. It is also recommended that you implement the modifications in the following order:
In this assignment you will construct three scenes: two scenes described in the two driver files given to you and one more scene of your choice by creating your own driver file with any objects and lights of your choice. Your code will be tested with two additional driver files, for a total of five files.
In all cases the camera view, lighting, and object placement should result in a well rendered final image. The image should be written in PPM format as described in P2.
Submit a tar file via the CANVAS assignment page that includes:
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 necessary for this assignment to take exactly two arguments as described above.
There is no “late period”. Key is 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.
To assist with preparing for p4, the drivers, models, and solutions used for grading are available at solutions.tar