Assignment 3: Writing your own Real-time Graphics
Due Wed. 9 November 2005

The purpose of this assignment is two-fold. First, the required section is to give you a fundamental respect for the complexities involved in rasterizing primitives to the screen. This knowledge will help you see the importance of fast rasterization, and the reasons why graphics cards are so specialized.

The second part of this assignment is your first chance to “choose your own adventure”. Recognizing that different students desire to obtain different skill sets out of a graphics class, this project has two choices for part two. The first is to continue your rasterization work, with a goal of implementing a large portion of a graphics API. The second choice is to advance into areas of OpenGL not previously assigned in this class.

Required Description Point Value
* PART I: 2D Rasterization

You must do all of the following using only GL_POINTS (or writing the values into your own buffer in RAM, and drawing it as a texture, etc.)

 
* Bresenham’s Line Algorithm - you must handle lines of ALL possible slopes. 10
* Triangle Rasterization - you can assume the triangle is not degenerate. (i.e. the triangle is more than one pixel wide at every point except vertices.) 10
* Line clipping 10
  PART IIa: Advanced 2D rasterization
The following may only use GL_POINTS (or texture as above)
 
  Implement another line rasterization algorithm. Compare with Bresenham for rasterization 1000 different lines (i.e. time both algorithm on the same set of 1000 lines). Report timings. 10
  Implement fully robust polygon rasterization: You must be able to handle convexities, self-intersections, and degenerate polygons (that end up rendering to only a line of pixels. (must be scan-line polygon algorithm) 15
  Implement a second form of line clipping. 10
  Implement triangle clipping 15
  Implement polygon clipping (allowing for concavities, etc). 10 (added to those for triangle clipping)
  Allow color to differ for each vertex of your polygon rasterization. Perform linear interpolation in between. 10
  Implement the Bresenham circle and/or ellipse algorithm. 10 (each)
  Supersample all of your above algorithms in order to reduce jaggies. 10
  Flood fill a polygon. Report if you use 4 fill, 8 fill, or boundary fill. If 8 fill, how do you make sure the edges are good boundaries? 10 (you can do both boundary fill and (4 or 8) fill for 20 pts)
  There’s a wealth of things to do here… suggest things. Points variable
  PART IIb: Advanced OpenGL Functionality

You are encouraged to search for topics in OpenGL which interest you. If you do this portion, you may want to look into 3D model import libraries and link them to your own code (you’ll want more than location and connectivity information here).

The ideas listed here are only a brief list of suggestions. Feel free to suggest something of your own.

 
  Link with a more advanced file reader. You must still write all the OpenGL rendering code yourself, and only retrieve location and attribute information from the file reader. (i.e. many file readers will render to OpenGL for you. That would be considered cheating.)

Passing this off consists of showing a complex model read in via this reader. Points vary depending on the difficulty and power of the file format.

Might I suggest lib3ds.

15-25
  Display a texture mapped model. Higher points available for cool models and textures. 10
  Read in some animation from the file (and/or a camera path). Display the animation properly. (If you have an animated camera path and animated motion of objects, you get 25 pts) 15
  If you didn’t do this for assignment 2, Gourand shade your models with GL_LIGHTS. 10 (if the model reader tells you the per-vertex normals)
20 (otherwise)
  Blend your texture and Gourand shading. 10
  Use display lists (or some other fast rendering method) to render your model. 10
  Use antialiasing 5
  Perform a readback from the buffer in order to capture a frame. Save it to some image format. 15
  Use the accumulation buffer to do an image processing technique 10
  Create an environment cube map. Save it to some image format. 10
  Use the accumulation buffer to add motion blur to one object in a scene. 15
  Use the stencil buffer to only show a specific part of the scene.

More points for really cool examples.

10
  Implement shadow volumes (even for simple objects) 20-50
Depending on quality and robustness
  Use the accumulation buffer to do depth of field.

Allow the depth of field to vary in z interactively.

25
  Alpha blend a set of transparent objects in a scene with opaque objects too. Don’t forget to sort on z (in camera space!). 10-25
(Depending on scene, etc.)