0% found this document useful (0 votes)
57 views29 pages

Visible Surface Detection (V.S.D) : (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

The document discusses several algorithms for visible surface detection including: - Depth-buffer (z-buffer) which uses a depth value for each pixel to determine visibility. - Depth sorting (painter's algorithm) which draws polygons from back to front but has limitations when polygons overlap in depth. - BSP trees which recursively partitions space using polygon planes to sort drawing order. - Area subdivision which recursively subdivides the screen area until one polygon is determined to be visible within that area.

Uploaded by

simrankamboj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views29 pages

Visible Surface Detection (V.S.D) : (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

The document discusses several algorithms for visible surface detection including: - Depth-buffer (z-buffer) which uses a depth value for each pixel to determine visibility. - Depth sorting (painter's algorithm) which draws polygons from back to front but has limitations when polygons overlap in depth. - BSP trees which recursively partitions space using polygon planes to sort drawing order. - Area subdivision which recursively subdivides the screen area until one polygon is determined to be visible within that area.

Uploaded by

simrankamboj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Visible Surface Detection (V.S.

D)
(Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

Given a set of 3D objects and a viewing specifications, determine which lines or surfaces of the objects should be visible. A surface might be occluded by other objects or by the same object (self occlusion) Two main approaches:
Image-precision algorithms: determine what is visible at each pixel.

Object-precision algorithms: determine which parts of each object are visible.

Coherence
Most methods for V.S.D. use coherence features in the surface: Object coherence.

Face coherence.
Edge coherence. Scan-line coherence. Depth coherence. Frame coherence.

Single Valued Function of two variables

Without Hidden-Line Removal

With Hidden-Line Removal

Floating Horizon Algorithm


Implicit Function: Y=f(X,Z). Represent as 2D array of x and z values, each entry is the corresponding y-value. Surface = many polylines; Each polyline is constant in Z. Algorithm:
Draw polylines of constant z from front (near z) to back (far z). Draw only parts of polyline that are visible: ie above/below the silhouette (horizon).

Use 2 1D arrays YMIN and YMAX (with 1 entry for each x). When drawing a polyline of constant z, for each x-value, test if above/below YMAX/YMIN (at x location) and update arrays.
40
A B G

30
D

20

10
E F

0 0
old YMAX old YMIN polyline

10

12

30 28 26 25 24 29 34 33 32 34 36 33 30 10 12 14 15 16 15 14 13 12 12 12 13 14 36 34 32 26 20 22 24 16 8 7 A D B C E 6 21 36 F G

new YMAX 36 34 32 26 24 29 34 33 32 34 36 33 36 new YMIN 10 12 14 15 16 15 14 13 8 7 6 13 14

Floating Horizon Characteristics: Applied in image space (image precision). Limited to explicit functions only. Exploiting edge coherence. Applicable for free-form surfaces.

Back Face Detection


Observation: In a volumetric object, you never see the back faces of the object (self occlusion). Reminder:
Plane equation: Ax+By+Cz+D=0 N=[A,B,C]T is the plane normal. N points "outside".

Back facing and front facing faces can be identified using the sign of VN In which coordinates N is represented?

V N=[A,B,C]

Three possibilities:
VN> 0 back face VN< 0 front face VN= 0 on line of view

For convex objects, back face detection actually solves the visible surfaces problem. Back face detection is easily applied to convex polyhedral objects. In a general object, a front face can be visible, invisible, or partially visible.

B A

D F H E

Back Face Polygons: A, B, D, F Front Face Polygons: C, E, G, H

Quantitative Visibility
First general hidden surface algorithm, by Appel 1967.

Definition: Every edge has a nonnegative quantitative visible value, Qv, which corresponds to the number of times the edge is obscured. If Qv=0 the edge is visible.

Definition: An active edge is a silhouette edge, i.e, it is shared by back and front faces.

Observations: The visibility of an edge can be changed only where it intersects another active edge in the viewing plane. If the edge does not intersect any active edge, its visibility is homogeneous.

Algorithm:
Select a single point on line and test how many polygons obscure it. Increment/decrement Qv any time the line intersects an active edge, and the intersection is inside the view triangle. Propagate from the end point to a neighboring line. Fill the resulting polygons appropriately.

Question: How do we know if the line enter or leave an obscuring face?

Answer: Edges of a polygon are described clockwise when viewing the object from outside (so the face is to the right). We test the configuration of the line direction with the direction of intersecting edge describing the front face.
Leave a face - decrease Qv

Enter a face - increase Qv

Depth-Buffer Method (Z-Buffer)


In addition to the frame buffer (keeping the pixel values), keep a Zbuffer containing the depth value of each pixel. Surfaces are scan-converted in an arbitrary order. For each pixel (x,y), the Z-value is computed as well. The (x,y) pixel is overwritten only if its Z-values is closer to the viewing plane than the one already written at this location.

Example of Compositing surfaces Using Z-Buffer

MM MM MM MM MM MM MM MM

MMM MMM MMM MMM MMM MMM MMM MMM

MMM MMM MMM MMM MMM MMM MMM MMM

5 5 5 5 5 5 5

5 5 5 5 5 5

5 5 5 5 5

5 5 5 5 5 5 5 5 5 5

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5M 5 5MM 5 MMM MMMM

5 5 5 5 5 M MM MM MM MM MM

5 M MM MM MM MM MM MM MM

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5M 5 5MM 5 MMM MMMM

5 5 5 5 5 M MM MM MM MM MM

5 M MM MM MM MM MM MM MM

5 7 6 5 4 3 2 0

5 5 5 5 5 5 5 5 7 5 5 5 6 7 5 0 5 6 7 0 4 5 6 7 3 4 5 6 0 0 0 0

5 5 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 70 0 0 0 0

5 5 5 5 5 5 5 M 5 5 5 5 5 5 MM 5 5 5 5 5 M MM 5 5 5 5 MM MM 4 5 5 M MM MM 3 4MM MM MM 2 3 4 M MM MM MMMM MM MM

Mistake

Algorithm:
Initialize the z-buffer and the frame-buffer: depth(x,y)=MAX_Z ; I(x,y)=Ibackground Calculate the depth Z for each (x,y) position on any surface: If z<depth(x,y), then set depth(x,y)=z ; I(x,y)=Isurf(x,y)

For polygon surfaces, the depth-buffer method is very easy to implement using polygon scan line conversion, and exploiting face coherence and scan-line coherence :
Z = -(Ax+By+D)/C Along scan lines
Z'= -(A(x+1)+By+D)/C=Z-A/C

Between successive scan lines: Z'= -(Ax+B(y+1)+D)/C=Z-B/C

Depth-Buffer Characteristics
Implemented in the image space. Very common in hardware due its simplicity (SGI's for example). 32 bits per pixel for Z is common. Advantages: Simple and easy to implement. Disadvantages:

Requires a lot of memory.


Finite depth precision can cause problems. Might spend a lot of time rendering polygons that are not visible. Requires re-calculations when changing the objects scale.

Depth Sort (Painter Algorithm)


Sort all of the polygons in the scene by their depth. Draw them back to front. Question: Does a depth ordering always exist? Answer: Unfortunately, no! For polygons with constant Z value, this sorting clearly works. For example: VLSI design, or in window systems.
x
x

Question: What if polygons are not Z constant? Observation: Given two polygons P and Q, an order may be determined between them, if at least one of the following holds:
1. Z values of P and Q do not overlap. 2. The bounding rectangle in the x,y plane for P and Q do not overlap. 3. P is totally on one side of Qs plane. 4. Q is totally on one side of Ps plane. 5. The bounding rectangles of Q and P do not intersect in the projection plane.

x
1

Z
2

Z
3 and 4

If all the above conditions do not hold, P and Q may be split along intersection edge into two smaller polygons.
x x

The BSP Tree


BSP = Binary Space Partitioning. Interior nodes correspond to partitioning planes. Leaf nodes correspond to convex regions of space.

A
B B

Tests 3 and 4 in Depth Sort technique can be exploited efficiently: Let Lp be the plane P lies in: The 3D space may be divided into the following three groups:
Polygons in front of Lp.
Polygons behind Lp. Polygons intersecting Lp.

Polygons in the third class are split, and classified into the first two. As a result of the subdivision with respect to Lp:
The polygons behind Lp cannot obscure P, so we can draw them first. P cannot obscure the polygons in front of Lp so we can draw P second. Finally we draw the polygons in front of P.

The BSP-Tree Algorithm


Construct a BSP tree:
Pick a polygon, let its supporting plane be the root of the tree. Create two lists of polygons: these in front, and those behind (splitting polygons as necessary). Recurse on the two lists to create the two sub-trees.

Display:
Traverse the BSP tree back to front, drawing polygons in the order they are encountered in the traversal.

1 3

1 3 6

1 3

7
4

6 5 4

Should be prepared from the beginning !

BSP Properties: The BSP tree is view independent! The BSP tree is constructed using the geometry of the object only. The tree can be used for hidden surface removal at an arbitrary direction. BSP = Object-precision alg.

Area Subdivision Technique (Warnock 1969)


Subdivide screen area recursively, until visible surfaces are easy to determine. Each polygon has one of four relationships to the area of interest:

Surrounding

Intersecting

Contained

disjoint

If all polygons are disjoint from the area, fill area with background color. Only one intersecting or contained polygon: First fill with background color, then scan convert polygon.

Only one surrounding polygon: Fill area with polygons color.


More than one polygon is surrounding, intersecting, or contained, but one surrounding polygon is in front of the rest: Fill area with polygonc color. If none of the above cases occurs: Subdivide area into four, and recurse. Area subdivision = Image precision technique.

When the resolution of the image is reached, polygons are sorted by their Zvalues at the center of the pixel, and the color of the closest polygon is used.

You might also like