Visible-line determination: examine edge geometry, and determine edge segments that are visible or are hidden
Z-buffer: device-precision algorithm that records the visible object found at each pixel
List priority algorithms: object-precise algorithms that sort objects such that when drawn in that order, a correct rendering of hidden surfaces occurs
Scan-line algorithms: image-precise algorithms that determine visibility one scan-line at a time
Area subdivision algorithms: divide-and-conquer applied to object areas
Ray tracing: determine visible object by tracing line from user eye to each pixel in scene
if you are drawing wireframes, then the hidden line problem is to find the lines or line segments that are obstructed by interceding polygons, and not draw them in full or part
eg. functions of 2 variables: y = f(x,z)
simple approach: for constant z values, compute values at x intervals, and draw lines between
polygon normal: the perpendicular ray (direction) from the plane containing the polygon
the equation of this plane determines the side of plane that normal points in graphics, useful to make the normal point towards the front of the poly.
if an object defined in terms of planar polygons, and if the object is closed, then we can then disregard drawing polygons whose normals are pointing away from user (neg values)
graphics routines: compute normal for the polygon; if it points towards user then use it; otherwise ignore it
z buffering (or depth buffering) is one of the simplest hidden surface algorithms
via hardware or software, an extra "z" buffer is maintained along with frame buffer. It keeps track of the nearest object at each pixel location.
initialized to minimum z value (eg. most negative)
then, when object being drawn, if its z coordinate at a point is greater (more positive, less distance to viewer) than z buffer value, it is drawn, and new z coord is saved; otherwise, it is not drawn
if a line seg in 3D is being drawn, then the intermediate z values between endpoint z coords are interpolated: linear interpolation for polygons, and can compute z for more complex surfaces
some problems:
aliasing: limited to size of z buffer word per pixel; can have imprecision at extremely far distances --> important to have as small a viewing volume as possible
possible to write into and manipulate z buffer memory directly, eg. cursors
also called "painter's algorithm": how a painter might paint a scene
sort all polygons according to smallest z coordinate of each (ie. distance to viewer)
resolve overlaps (split polygons if necessary)
scan convert polygons from farthest to nearest
algorithm works for objects that lie in planes of constant z
(eg. windowing systems), or those whose z extents do not overlap
--> step 2 not required then
otherwise, step 2 must test whether polygons do not overlap, if any of these tests are true:
i) polygons' x extents overlap
ii) polygons' y extents overlap
iii) their projection extents on x-y plane overlap
iv) one polygon is on one side or the other of other's plane and if so, split them up using clipping
with simple objects and meshes (eg. closed solid volumes), this technique is often quite efficient, because objects can be drawn from furthest to closest without worrying about overlapping polygons.
Idea: try to make an easy decision about which polygon is visible in a section of the image (area coherence)
If a decision cannot be made, subdivide the area recursively until one can be made.
Can be device-precise (stop at pixel) or object-precise (stop at error range)
Recursive algorithm:
divide image into 4 equal areas
for each area (see tests below):
1. are all polygons disjoint from area? (test d)
yes --> display background colour
2. only one intersecting or contained polygon (tests b, c)
yes --> fill with background colour, and then draw contained polygon or intersecting portion
3. one single surrounding polygon, no intersecting or contained polygons (test a)
yes --> draw area with that polygon's colour
4. more than one polygon is intersecting, contained in, or surrounding, but only one polygon is surrounding the area and is in front of others (test a)
yes --> draw area with that front polygon's colour
e) ELSE --> subdivide the area into 4 equal areas and recurse