6.837 F98 Lecture 16: November 10, 1998


(Thanks to John Alex for help preparing these slides.)


Administrative

Tests returned at end of class.
Project 4 assigned at end of class.

Visibility

Our trip through the graphics pipeline is nearly complete.

We now know how to transform, clip, and project polygons into NDC
    (Canonical coordinates, normalized device coordinates)

But we only recently addressed what to do when scene primitive is invisible;
    that is, when it contributes no pixels to the rendered framebuffer.

A scene primitive can be invisible for three reasons:

Obviously we don't want to spend a lot of work processing things
which contribute nothing to the rendered image.  Thus, the following
fundamental questions of visibility computation arise: First example of visibility computation:  clipping to view frustum (last time)

Second example of visibility computation:  back-face elimination


Q.  How can we implement this?

Idea: compare view direction, face normal

for each face F of each object
    N = outward-pointing normal of F
    if N dot V > 0, throw away the face


Can we apply this "normal test" anywhere in the pipeline?


When should back-face culling be used?
What is its cost for a collection of n polygons?

Back-face culling is an example of a criterion that can be applied anywhere
along the pipeline:  in world coords, eye coords, NDC, even in screen space !

Where is the best place in the pipeline to apply back-face culling?

What portion of the scene will it tend to eliminate, on average?

Suppose we clip our scene to the frustum, then remove all back-facing polygons.
Are we done?  That is, does this solve our visibility problem?

No!  For most interesting scenes and viewpoints, some polygons will overlap;
somehow, we must determine which portion of each polygon is visible to eye.


One possibility:  simply draw the polygons in the "right order" so that the
right picture results (example:  blue, then green, then peach).  So is
visibility just a back-to-front sorting problem?
 
 

In 2-D, for non-intersecting line segments, yes -- visibility reduces to sorting.
However, in 3-D even non-intersecting polygons can form a cycle (above),
which has no valid visibility order!

Early algorithms for visibility (now called "analytic" algorithms) computed the
set of visible fragments directly, in object space, then rendered the fragments
to a pen plotter, or to a vector display, or (a bit later on) to a framebuffer.

What is the cost of describing (and computing) the fragment map at right (above)
for a scene composed of n polygons (say, triangles or quadrilaterals)?
 
 








... It's quadratic in n !

Now, as soon as renderers were invented, people started crafting geometric models.
Realism called for lots of polygons, which spelled trouble for these costly algorithms.
So, for about a decade (from the late '60s to the late '70s) there was intense interest
in finding efficient algorithms for efficient hidden surface removal.

There's quite an extended literature about this; today I'll show just two nifty algorithms, one
called BSP traversal from 1979/80, and one called Warnock's algorithm, from 1968/69.
 

BSP tree construction and traversal (Fuchs et al, 1980)

BSP means "binary space partitioning"; organizes all space into a binary tree

BSP traversal is one of a class of "list-priority" visibility algorithms

Preprocess: Building a BSP tree out of polygons
  1. split along the plane of any polygon
  2. classify all polygons into positive & negative halfspaces of the plane

  3. * if a polygon is on the plane, split it in half
  4. recurse down the positive halfspace
  5. recurse down the negative halfspace
each node stores a plane, the polygon on that plane, and two child pointers,
    one each for the positive & negative halfspaces.






Building a tree from non-polygonal objects
    choose split planes that "well-separate" objects from one another:

  1. if only one object left, we're done.
  2. split along any plane, preferably one that divides the objects well
  3. classify all polygons into positive & negative halfspaces
  4. if any objects intersect the plane, split them in half (may be costly!)
  5. recurse to construct subtrees for the two children.

    each node stores a plane and two child pointers
    no object on the plane
 

Dynamic query: Produce ordered polygon list from the tree, instantaneous eyepoint
node::draw (viewpoint)

Intuitively:  at each partition, draw the "farther side", then the "nearer side"

BSP traversal is called a "hidden surface elimination" algorithm, but it doesn't
really "eliminate" anything; it simply orders polygons so the resulting
picture is correct.

Can we always find a polygon ordering (without fragments) that
gives the right rendered image?
 
 

... Nope !

What are the time and space requirements for a BSP tree of n polygons?
What is the cost of a query for a single eyepoint?
 

Next: Warnock's algorithm (1969).  This is an elegant hybrid of object-space
and image-space computations, based on a simple idea that has recurred
over and over again in computer graphics:  If the situation is too complex,
subdivide.

0) start with a "root viewport", and list of all scene primitives
    (transformed to screen-space)

Then, recursively:

1) classify each object as incident, or outside of, viewport

2) if number of objects is zero or one,
    visibility is established for this portion of the screen
else
    subdivide into smaller frusta, distribute incident objects to them, and recurse.
 

What is the termination condition ?

And how is the correct surface identified in this case?

Third example of a visibility operation is z-buffering (or depth buffering).

Both of the above algorithms were proposed when memory was very expensive
(the first 512 x 512 framebuffer cost more than fifty thousand dollars).

In the mid-70's, Ed Catmull had access to a framebuffer and proposed a
radically new visibility algorithm: z-buffering.  The idea of z-buffering is
to resolve visibility independently at each pixel.

            

Properties of depth-buffer:

After initial resistance, the world adopted z-buffers in the mid-1980's. And now a word from our sponsor (LM) about exam, next project.
 

Previous Meeting .... Next Meeting ... Course Page


Last modified: Nov 1998

Prof. Seth Teller, MIT Computer Graphics Group, seth@graphics.lcs.mit.edu