University of California, Berkeley
EECS Dept, CS Division
SLIDE: Scene Language for
Interactive Dynamic Environments
|Prof. Carlo H. Séquin|
In this assignment, you are building slidescan, a polygon scan converter which implements a Z-Buffer algorithm for visibility calculations. The scan conversion algorithm will compute a winding number for each polygon at each pixel and will fill the area outlined by the polygon boundary according to the parity rule or the non-zero winding number rule depending on the currently selected option.
New options appear in bold.
See the class notes on scan conversion.
You will be using a software frame buffer to hold the intermediate results of the scan conversion. This buffer is width x height of the window where the first element (0, 0) is the bottom left hand corner of the window. As you set the color of each pixel that is interior to a polygon, you will add the color of that pixel to the current color of the frame buffer if it has the same Z value of the pixel currently stored. This will help you to identify pixels that have erroneously been assigned to multiple polygons. After rendering all of the polygons in one render statement to the software frame buffer, the contents of that buffer will be drawn to the screen with the GLDrawPixels command.
In the scan converter, you will be given the list of vertices around the polygon. These vertices will be in their full 4D Homogeneous form in the canonical half cube. You will need to apply the homogeneous division by W and apply the viewport mapping matrix Gvp<-proj.
For each polygon in the scene, after it has been fully transformed and clipped, scan convert that polygon to the software frame buffer by the following steps:
Create a list of all of the edges in the polygon, sorted by the y-coordinate of their lower ends. This is the edge list
Start at the lower y-coordinate of the viewport. Create an empty list of edges, called the active edge list (AEL).
For each scanline:
Along with the frame buffer that holds the pixel color values, you will have a Z-Buffer which is an array of 8 bit integers. After the homogeneous divide, all of your Z values will be in the range [0, -1]. You need to convert the current Z value to an 8 bit integer for each pixel, check to see if this value against the current value, and only contribute to the frame buffer if the current value is closer than the previous value.
When updating Z, you should compute a dz/dy and dz/dx for the polygon and use these deltas to incrementally calculate the current Z value.
Follow the listed instructions
Here is a pre-compiled reference solution
(Windows .exe in .zip format).
The SLIDE Implementation Specification gives information about the C++ class structure which implements the SLIDE viewer. It also gives an outline of the operation of the viewer.
This page was originally built by Jordan Smith.
Last modified: Wednesday, 27-Oct-2004 16:26:01 PDT