Scan-Line Conversion &
Z-buffer Hidden Surface Removal
Andrew G. Zaferakis
UNC Chapel Hill
COMP 236 Spring 2000
Homework 3 - Triangle Rasterization
-
Part A: The written assignment.
-
Part B: The coding assignment.
-
SoftGL: The software renderer
-
SoftGL is our software version of OpenGL, we intend to supply a subset
of the OpenGL extensions, and implement many different features that OpenGL
does not have. Each assignment will build on our SoftGL code so check
back often.
-
Download the SoftGL viewer: (pc,
sgi)
-
Download the tie fighter text model: tie.tri
The model below is composed of 3,000 triangles, thanks
to Kenny Hoff for the model.
On the left is the model viewed using SoftGL, which contains our own homogeneous
clipper, matrix stack, and triangle rasterizer. On the right
is the OpenGL rasterization, as you can tell, the two images are identicle,
each pixel matches. When viewing this you can swap between SoftGL
and OpenGL by pressing the spacebar, there will be no changes in the pixels.
The only allowable changes are when there are two co-planar polygons which
causes z-fighting, a known problem that exists even in hardware.
The SoftGL is comparable in speed to the OpenGL for small models, however
as the polygon count increases, the hardware will always win. This
model has very little slowdown when viewing, try it out!
SoftGL
|
OpenGL
|
|
|
SoftGL Viewer Controls
Mouse |
Used to Rotate |
Left Button |
Locks mouse movements to controls |
ESC |
Exit |
SPACE |
Toggle SoftGL vs OpenGL mode |
The following pictures have been generated in LightScape
and exported as triangles, thanks to Paul
McLaurin. This model is composed of 47,781 triangles. As
you can tell the model has been radiositized and this the color shown here
is per-vertex, the SoftGL code is doing no color interpolation,
just flat shading. The density of the triangles is what gives us
a smooth looking model. The first picture is the outside of a building,
the second is a view from the inside. Click on the image for a larger
view. As before there are no differences between the SoftGL
rasterization and the OpenGL rasterization. Check back in future
assignments to see SoftGL in a bigger, bolder, more robust form performing
phong shading, texturing, lighting and plenty more.
346 Sitterson Hall, CB #3175, Chapel Hill, NC 27599-3175,
andrewz@cs.unc.edu