The Hidden/Visible Object Problem

by William Shoaff with lots of help


Contents

Hidden Object Removal

Hidden Object Algorithm Basics

Backface Culling



\begin{picture}(315,195)(120,635)
\put(120,740){\vector( 1, 0){160}}
\put(116,73...
...t(375,735){\line( 1, 5){ 19.038}}
\put(395,830){\line(-3,-2){ 45}}
\end{picture}

The Visible Surface Problem

The Floating Horizon Algorithm

Pseudocode for floating horizon

Overview of Point Sampling Hidden Surface Algorithms

It is useful to consider the structure of the four most widely used point sampling hidden surface algorithms [1].

1.
Pseudocode for z-buffer
2.
Pseudocode for ray casting
3.
Pseudocode for scanline
4.
Pseudocode for painter's

The z-buffer and ray casting algorithm differ only in the order of their main loops. The z-buffer algorithm handles objects one at a time and operates on all covered pixels, the ray casting algorithm handles one pixel at a time and compares every object's depth at a pixel.

All point sampling algorithms can produce aliasing artifacts since they may miss important data in the pixels they sample. There are anti-aliasing techniques that can be used to mitigate these problems.

Another factor in choosing a hidden surface algorithm is its support for other rendering effects such as transparency. Ray casting, scanline and the painter's algorithm all handle transparency well since all of the coverage information is known, however, due to the processing loops in the depth buffer algorithm it is harder to incorporate transparency.

The z-Buffer (Depth-Buffer) Algorithm

Given:

Here's a more complete pseudocode for z-buffer

The Ray Casting Algorithm

The ray casting algorithm is a precursor to ray tracing.

Pseudocode for ray casting

The Scan-line Algorithm

The Painter's (Depth-Sorting) Algorithm

Binary Space-Partition Tree

Pseudocode for Building BSP tree

Pseudocode for Displaying BSP tree

Warnock's Algorithm

Problems

1.
What is back-face culling?
2.
How is testing for a back-face done?
3.
Let 3x-2y+6z-5=0 be the equation of a plane viewed from eye position $e = (1,\,1,\,1)$, while looking at the point $a=(0,\,0,\,0)$. Is the front of the plane visible?
4.
What is the difference between an image space and an object space hidden surface algorithm?
5.
What is coherence?
6.
Let curves at z=0, z=1 and z=2 be defined by

\begin{displaymath}y= (x-20)^2 \quad \mbox{for $0\leq x \leq 40$},\end{displaymath}


\begin{displaymath}y= -(x-20)^2+400 \quad \mbox{for $20\leq x \leq 40$},\end{displaymath}

and

y= 300,

Show how the floating horizon algorithm would draw the surface.
7.
Describe the basic flow of control for the z-buffer algorithm.
8.
What incremental technique can be used in the z-buffer algorithm?
9.
Suppose you are given a $2\times2$ frame buffer and z buffer initialized as shown to the background color and the far value of z.

\begin{displaymath}F=\left[\begin{array}{cc}
0.0 & 0.0 \\
0.0 & 0.0 \\
\end...
...rray}{cc}
1023 & 1023 \\
1023 & 1023 \\
\end{array}\right]\end{displaymath}

Show the contents of both the frame buffer and the z buffer after processing polygons P1, P2 where

\begin{displaymath}P_1=\left[\begin{array}{cc}
(512,\,0.4) & (128,\,0.3) \\
(...
...2,\,0.6) \\
(300,\,0.5) & (418,\,0.2) \\
\end{array}\right]\end{displaymath}

Here the notation $(z,\,I)$ at each pixel indicates the z depth and the intensity of the polygon at the pixel.
10.
What is the basic concept of the Painter's algorithm?

11.
What is an important advantage of a binary space partition tree?
12.
Show how to construct a binary space-partition tree from the polygons displayed below starting with polygon A as the root. Note the polygons are displayed as line segments (think of viewing them on their edges) with an arrow indicating the front side of the polygon. Clearly explain how your tree is built.


\begin{picture}(275,215)(210,545)
\thicklines
\put(380,720){\line(-3,-4){ 60}}
...
...
\put(365,550){\makebox(0,0)[lb]{\raisebox{0pt}[0pt][0pt]{ $F$ }}}
\end{picture}

13.
What are the basic tests in Warnock's algorithm?

Bibliography

1
K. JOY, C. GRANT, N. MAX, AND L. HATFIELD, Computer Graphics: Image Synthesis, IEEE Computer Society, 1989.


William Shoaff
2000-11-20