Viewing Transformations and the Graphics Pipeline
Spring 1999
For each Object
For each Polygon
For each edge (v1,v2)
determine how many faces cover v1
{for each object, for each polygon}
Determine all edges that intersect (v1,v2):
For each object
For each edge
intersect 2D projection of (v1,v2) with edge
if (v1,v2) behind edge
record x,y,z intersection and +/- 1
sort intersections
keep running count (v1,v2): if count 0, visible
In a simple ray caster you can trace the scene in a restricted world (eye) space by requiring the viewer to be at the origin, looking down the negative Z-axis
for each pixel
Determine the closest object
along the ray from the eye pt.
through the pixel.
Find it's color.
Set pixel color to this color.
Initialize frame-buffer and Z-buffer
for each polygon P
for each pixel in poly's projection: x,y
pz = the Z value of P at this pixel
polycolor[x][y] =
color of P at this pixel
if Z-buffer[x][y] <= pz
Z-buffer[x][y] = pz
FB[x][y] = polycolor[x][y]
end for each pixel
end for each polygon
Initialize scanline color-buffer CB and Z-buffer
for each scanline
for each polygon P active in the scanline
for each x in poly's projection
pz = the Z value of P at this pixel
polycolor[x][y] = color of P at this
pixel
if Z-buffer[x] <= pz
Z-buffer[x] = pz
CB[x] = polycolor[x][y]
end for each x
end for each polygon
draw the color-buffer CB to the screen
end for each scanline
See Figure 15.42 from F&vD pg 687.
Spanning Scanline (Walkins, Romney)