Motivation

In the past assignment you wrote code to read a 3D model and a 3D camera specification and then carry out ray casting, but stopping just short of rendering a scene with material properties and lighting. In this assignment you now will lighting, material properties and along the way spheres in addition to polygonal 3D models. Also, unlike before, in this assignment you will be asked to create specifications for scenes of your own design and then demonstrate that your ray casting system is capable of rendering these scenes.

In this assignment you are explicitly not being asked to perform recursive ray tracing nor are you being asked to handle semi-transparent objects. In other words, no light refracting through spheres. You may anticpate these to additions as part of the final Project 5 .

Data Formats

In order to convey materail properties succinctly it will prove hepful to move away from the PLY File Format and instead move to a combination of Alias WaveFront OBJ models and an extended custom scene definition file. More will be said in lecture about these formats.

Because it is specific to this class and this semester of CS 410, here in detail is a description the scene description file. Think of this as an expanded version of the camera specification file from the previous assignment. To explain the file format, let us work first from an example.

eye 4 4 4
look 0 0 0
up 0 0 1
d 2
bounds -1 -1 1 1
res 256 256
ambient 0.1 0.1 0.1
light 0 4 4 1 0.50 0.25 0.25
light 4 0 4 1 0.25 0.50 0.25
sphere 0.5 0.5 3.5 0.5 0.6 0.6 0.6
model 0.0 0.0 0.0 1.0 0.0 0.0 0.0 ellelltri.obj

 

The initial six lines of the file are identical to before (see Assignment 3 for details). New is the facilty to specify multiple ligh sources, spheres, and file pointers to polygonal models to add to the scene.

After resolution is specified, note the next line specifies the ambient illumination in the scene. This is a low level 'white' light with values of 0.1 on a zero to one scale. After specifying the amount of ambient light in the scene, zero or more light sources may be specified. The first four values given are the x, y, z and w coordinates of the light source in world coordinates. The fourth value w is generall one, but a zero indicates a light source at infinitiy in the direction specified by z, y, and z. The last three values indicate the red, green and blue levels of the light source on a zero-one scale

Following the light sources come zero or more spheres. The first three values are the x, y and z coordinates of the sphere in world coordinates. The fourth value is the radius of the sphere. The last three values are the simplified material properties indicating the 'color' of the sphere in terms of red, green and blue.

Finally, zero or more polygonal models may be specfied for inclusion in the scene. Note the first seven values may indicate a Model to World transformation. Specifically, the first three are the x, y, z translation from model to world coordinates. The next four specify an axis-angle rotation. In this assignment you may ignore these values if you wish and assume an identity transformation between the model and the world. Keep in mind this may change in the last assignment. The last argument is a string indicating the name of the file containing the 3D polygonal model in OBJ format.

Here is a very important detail not to overlook. The *.obj file for a model probably in turn specifies a material file that your program most load to understand the material properties associated with the faces in the model.

Task

In this assignment you will construct four scenes. These will build in complexity and increasingly allow for creativity on your part. In all cases the camera view, lighting, and model placement should result in a well rendered final image.

Scene 1
A simple sphere with radius one centered on the origin. The sphere material should be pure white. The camera should be placed three units out the positive z axis. The sphere should be in full view and fill roughly 40 percent of the entire image. There should be two light sources, one above and to the right of the camera and the other above and to the left of the camera. The right camera should have a red hue and the other a green hue. There should be no ambient light in this scene.
Scene 2
Create a scene with at least six spheres and no polygonal models. Make each sphere a different color and illuminate the scene with at least two point light sources such that highlights are clear.
Scene 3
Construct a scene using one Polygonal model consisting of at least 100 triangles. Light the scene with at least two point light sources. You may use a single material for the entire object.
Scene 4
Construct a scene involving at least one Polygonal model and one sphere and light this scene using at least to point light sources.

Submission

Make a tar file that includes all of the code, camera files, and model files necessary to demonstrate your program. For grading, you must name your executable 'raytracer' and it must take a single scene file as an argument. The submitted scene files should be named as scene1.txt, scene2.txt, scene3.txt, and scene4.txt. Keep in mind that the scene file may containe zero or more model file names that should in turn be loaded.

Addendum (Last update 11/04/16)

The submission instructions have been corrected. (11/04/16 Ross)

The submission instructions have been corrected. (11/18/16 Jake)