Sweep-Plane Based Hidden-Feature-Elimination
In Image Space:
Simplest approach: Handle each polygon "separately".
In the dynamic data structure that tracks the current scan-line
there is an "Active Polygon List" that enumerates in arbitrary order all polygons
that are intersected by the current scan-line (sweep-plane position).
For each active polygon, there is an attached list of active edges
Compute the "inside" spans on a per-polygon basis; then write them to z-buffer.
Exploit Coherence on Scan-line:
(If you don't have z-buffer, but want to do this in software)
Sort all the active edges on the scan-line; process all at once
from left to right.
Depth order will not change randomly at any x; can only change at edges
or at (virtual) intersection lines
(to be found!).
During the x-sweep, keep depth-sorted active face list; check & update
list at every edge intersection.
If list is out of order, there was a cross-over; compute cross-over
point, and backtrack to it.
Exploit Line to Line Coherence:
Depth ordering of active faces does not change between vertically adjacent
Also track intersection lines from line to line.
Now we can keep track of top face in each span;
this stays the same from line to line and needs to be evaluated only
at new edges & edge intersections,
i.e., at ends of coherent spans. --> NO z-buffer needed, all done in
In Object Space:
There is no need to do above analysis on every scan-line !
Just do it at interesting y-locations: i.e., at vertices, and
y-values where (projections of) edges intersect.
Do this with full object-space precision. Keep track of emerging contours
of visible parts;
send visible polygon pieces to output/display device. Exploit coherence
of polygon contours.