CSE681 Lab 2

Winter 2011
due Jan. 31


input file input file
input file input file

FINALIZED

Objective

To add
  1. the use of a scene description file
  2. the use of transformations (NOT including non-uniform scale)
  3. handling multiple light sources.
  4. handling multiple spheres.
  5. modeling diffuse and specular illumination,

Assignment


Scene Description File

commandaction
#
Ignore all text up to the end-of-line
camera <x> <y> <z> <cx> <cy> <cz> <angle> <aspect> <hither> <yon> <tilt> <xres_i> <yres_i>
Record the camera parameters: position, center-of-interest, vertical half angle of view, aspect ratio, hither and yon clipping distances, tilt (rotation around viewing direction from 'up', x and y image resolution (integers).
ambient <a>
Record the ambient value.
background <r> <g> <b>
Record the background color.
output <filename_s>
Record the output filename.
identity
Set the current matrix to the identity.
rotate  [x|y|z] <degrees>
Form the appropriate rotation matrix and multiply the current matrix on the left
translate  <tx> <ty> <tz>
Form the appropriate translation matrix and multiply the current matrix on the left
scale  <x> <y> <z> 
Form the appropriate uniform scale matrix (for this lab, you can just use the 'x' parameter) and multiply the current matrix on the left
sphere <r> <g> <b> <texture-name_s> <kd> <ks> <n_i> <kr> <gl> <kt> <n1> <tr>
Create an additional sphere in the scene data structure, transforming it according the current transformation matrix and record its parameters: color, ignore the texture name text string, diffuse coefficient, specular coefficient, specular power and for this lab, ignoring the last five parameters.
light <x> <y> <z>  <intensity> <size>
Create an additional light in the scene data structure and record its parameters: position, intensity, and, ignored in this lab, size.

Sample submission and execution

Submit the source code for your program. For example:

submit c681aa lab2 lab2.c makefile
Of course, you can break it up into multiple source files and submit those. For example:
submit c681aa lab2 main.cpp camera.cpp sphere.cpp light.cpp makefile
- just as long as the grader can make and execute your program using whatever input file the grader wants to as an argument to lab1:
make
lab2 <input filename>
and the ppm file should be found in whatever output filename is specified in the input file (or 'output.ppm' if none is give).

Under UNIX, the ppm file, output.ppm in this example, should be able to be viewed using:

convert output.ppm output.jpg
display output.jpg

Extra credit

Submit a README.txt along with your lab files to explain the extra credit you are applying for.
  1. Additional object types (up to 10% depending on complexity)
  2. Background scene (5%)

Notes


Last updated 1/26/2011

class home page