Due: Monday, May 19, 1997, 2:00 PM
Objective
The goal of this project is to write a ray tracing renderer. Your
program should be able to read scene data from a file according to a
defined scene description language. You also need to create a scene
on your own.
Scene Requirements
The scene you build should have at least five
polygons and five spheres. Your lighting
model should include global ambient lighting,
at least one point light source, diffuse and specular
lighting, and reflected images of other
objects in the scene. Objects should cast shadows.
Transparency (refraction) is optional and will be counted toward
upgrading your overall quarter grade to a higher level if it
falls a bit short.
For simplicity, we assume that the global ambient light has intensity
of 1.0 (for all the R, G, and B color components).
Your scene should clearly demonstrate the features you choose to
implement.
Scene Description Language
-
read filename[.cli]
lookat from at up
scale x y z
translate x y z
rotate angle ax ay az
push
pop
-
These have the same functionalities as those in the previous project.
-
fov angle
-
Specifies the field of view for a perspective projection. In this
project there will be no near/far clipping and you will also only need
to implement perspective projection.
-
bg r g b
-
Background color.
-
light x y z [r g b]
-
Point light source. Its color is optional (the default is white).
-
surface Kar Kag Kab Kdr Kdg Kdb Ksr Ksg Ksb Shine Refl Trans [RefractionIndex]
-
These apply to objects that follow such as polygons and spheres.
Ka is the ambient coefficient, Kd is the
diffuse component, Ks the specular, Shine is
the Phong cosine power for highlights, Refl is the amount
of reflection (fraction of contribution of a reflected ray), and
Trans is transmittance (fraction of contribution of the
transmitting ray). Usually, 0 <= Kd <= 1 and 0 <=
Ks <= 1, though it is not required that Kd + Ks ==
1. Note that transmitting objects (Trans > 0) are
considered to have two sides for algorithms that need these (normally
objects have one side).
-
sphere x y z radius
-
A sphere with its center at
(x, y, z). The sphere is to
be transformed by the current transformation matrix that is on the top
of the matrix stack. This includes the view matrix (specified by the
lookat command).
-
begin
vertex x y z
vertex x y z
vertex x y z
end
-
Instead of drawing lines, vertex commands that are inside a pair of
begin/end commands will now specify polygon
vertices. The number of vertex commands determine the
number of vertices of a polygon. All of the (x, y, z)
values in a vertex command are transformed by the current
transformation matrix.
-
write filename[.ppm]
-
Ray-traces the scene and saves the image to file.
Note on color specification:
Each of the red, green, and blue components range from 0.0 to 1.0.
Example Code
There's a matrix inversion example:
~cs4391/proj2/assignment/invert.c
And a few example test cases are in:
~cs4391/proj2/assignment/tests
on College of Computing UNIX machines.
Submission
To submit your program, put your project files in a directory on a
College of Computing UNIX machine, then execute the following command
in that directory:
shar *.c *.h makefile your_scene.cli | elm -s "proj2" cs4391@cc.gatech.edu
Basically you need to put all the program source code files, header
files, the makefile, and your scene description file after
the shar and before the | pipe.
The shar and elm commands are in the
/usr/local/bin directory.
Authorship Rules
The code that you turn in must be entirely your own. You are allowed
to talk to other members of the class and to the instructor and the TA
about high-level questions about the assignment. It is also fine to
seek the help of others for general C programming questions. You may
not, however, use code that anyone other than yourself has written.
Code that is explicitly not allowed includes code
taken from the Web, from books, or from any source other than
yourself. The only exception to this rule is that you should use the
routines that we provide. You should not show your code to other
students. If you need help with the assignment, seek the help of the
TA. Check the Programing Assignment
Policy for details.
Last modified: 16-May-97