EECS 487

Project 1: Scan Conversion

wireframe cow colored cow
Fig. 1. A scan converted cow. Left: wireframe (no colors). Right: filled triangles (using vertex colors).


Overview

In this project you will implement the midpoint line drawing algorithm to rasterize line segments, and also a simple method for scan converting triangles and using barycentric coordinates to interpolate colors. Both algorithms are described in our textbook, Fundamentals of Computer Graphics.

You are given support code for this project and will need to
  1. install the jot library (see below),
  2. copy the project support code and edit the makefile to indicate jot installation information, and
  3. implement the missing functionality.

Jot

The support code is based on jot, a collection of C++ libraries that support 3D graphics applications. jot was developed at Brown University, Princeton University, and the University of Michigan, runs on Mac OS X, Windows and Linux, and has been used in a number of research projects, including WYSIWYG NPR. Your first step will be to get the jot source code and compile it. For instructions, click here.


Support Code

Next, copy the project support code to your local machine:
  % scp -r red.engin.umich.edu:/afs/engin.umich.edu/class/perm/eecs487/proj1 .

The C++ source code file p1.C contains this support code. Read through this file to get familiar with it, then implement the following missing functionality:

Lines:
Triangles:
Transparency:
Code quality:
  1. Comment your code reasonably, particularly your design decisions and choice of approach.
  2. Modularize your code: use a suitable number helper functions with descriptive names.
  3. Use descriptive variable and function names: apply a suitable tradeoff between symbol-length and descriptiveness.
    Bottom line: Make your code readable! 10 points


Modifying the code:

Implementation of the missing functionality must begin within bodies of two functions with the following prototypes:

  void scan_convert_faces(CGELlist& gels, RefImage& img, double opacity);
  void scan_convert_edges(CGELlist& gels, RefImage& img, double opacity);

You will find these prototypes at the top of p1.C and skeletal definitions somewhere within p1.C. You starting points are marked with the comment: // YOUR CODE HERE

Declare and define helper functions as you see fit.


Building and running the code:

Edit the provided Makefile to define the path to your jot directory. Then you should be able to compile the program, as follows:
  % cd proj1
% make
This results in an executable named p1 which takes a model file as a command-line argument, for example:

  % p1 models/house.sm

A number of models are provided for you to run your code on. Model files are located in the proj1/models directory and have .sm extensions. When you run your code, with the cursor in the rendering window, press key 'g' to toggle between OpenGL rendering (built into the support code) and your scan conversion code. Since your code is  not yet written, you will initially toggle between seeing the model (rendered in OpenGL), and not seeing it.


Handing in

Turn in two files: your version of p1.C, and a brief write-up in text format that discusses:
  1. anything about your implementation that is noteworthy (e.g., your method for clipping lines, or for interpolating colors along line segments), and
  2. feedback on this assignment, including suggestions for how it should be changed next time.

Specific instructions for how to turn in your work:

Use the submit487 script to submit your files as follows from any CAEN linux machine:

% /afs/engin.umich.edu/class/f05/eecs487/submit487 1 p1.C writeup.txt

  • The first argument is the project number and must be 1 for this project.
  • The other two arguments are the names of the files you are submitting:
    • in any order,
    • the writeup need not be named writeup.txt
    • the writeup must be a text file (i.e. should be readable using notepad, vi, emacs etc)
  • You will receive a confirmation later. (not necessarily immediately)
  • The script depends on a few utilities like shar, basename and mail. These are definitely present on red.engin.umich.edu. Try this host if a bunch of other hosts fail.
Important: Do not attempt to copy this script to your directory and/or modify it in any way. Violations are easily detectable and will be dealt with severely. Contact the GSI should anything come up.


Multiple submissions:
  • You are allowed to make a maximum of two submissions.
  • In case you submit two or more times, only the second (never the first) will be considered.
  • Penalties apply depending on the number of submissions exceeding two.
  • The submission script does not count your submissions!

Due date

The project is due on September 26, 2005, by 11:59pm. Turning it in 48 hours earlier is worth a 4% bonus; turning it in 24 hours early is worth a 2% bonus.


Last updated: 23 Sep 2005