In the past assignment you wrote code for a ray casting system capable of rendering polygonal scenes described in the driver files. In this assignment you will be adding more capabilities. In particular, you will add an ability to render spheres, specular reflection, and shadows. You should expect to have zero or more light sources and zero or more objects in the scene. Objects could be .obj models or spheres. You are not being asked to perform reflections i.e., recursive ray tracing. Recursion will come in programming assignment 4.
The driver file used here is identical in format to that used in the previous assignment with one exception. There is a new field specifying additional sphereical objects.
sphere -1.0 -1.0 -1.0 5 0.2 0.2 0.2 0.5 0.5 0.5 0.5 0.5 0.5
1.0 1.0 1.0
There could be zero or more spheres. The first three values are the x, y, and z coordinates of the center of the sphere in world coordinates. The fourth value is the radius of the sphere. All the next values are the simplified material properties indicating the 'color' of the sphere in terms of red, green, and blue. First triplet after the radius represents (Ka_red, Ka_green, Ka_blue) ambient coefficients. Next triplet represents diffuse (Kd_red, Kd_green, Kd_blue) coefficients. Next we have (Ks_red, Ks_green, Ks_blue) specular coefficients. Finally, we have (Kr_red, Kr_green, Kr_blue) attenuation coefficients. Your are not going to use the attenuation coefficients for this assignment. For spheres use phong constant = 16.
By intention, this programming assignment is meant to be a modest extension of what you already built in Assignment 2. Your approach should be to use it as a opportunity to simplify and improve where possible your current code and then in sequence add each of the three new functionalities. Each now functionality, in and of itself, is modest in scope. For grading you will be asked to render two scenes as defined by driver files and models being provided to you. In addition, you must design and render your own scenes. A big part of what will make makes your new scenes interesting will be in the interaction of objects through occlusions and shadows.
To accomplish this assignment you must complete three principle tasks:
You are encouraged to structure your work so you complete each of these in sequence before moving onto the next.
In this assignment your code will be responsible for correctly rendering five scenes, three of which are described in the driver files given to you in the drivers_models.zip file provided below and the other two will be of your choice while adhering to the guidelines described below.
Your program will take two command line arguments. The first argument is a driver file. The second argument is the name of the image your program will write back to the disk in the same folder where your executable is located. A C++ example is:
$./raytracer driver00.txt driver00.ppm
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 must for this assignment to take exactly two arguments as described above.
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.
Fixed a statement that said 'four scenes' instead of 'five scenes'.
scene_ppms.zip file is available now.
Here are the unkown test cases test_cases.zip