You are on page 1of 21

VISIBLE SURFACE DETECTION

Visible surface detection algorithms

Object Space Mixed


Methods Methods
Image Space
These methods compare objects Methods Use both the
and parts of objects to each other techniques
within the scene definition to Visibility is decided
determine which surfaces as a point by point at each
whole we should label as visible. pixel position on the
projection plane
VISIBLE SURFACE DETECTION
Object Space Methods
Back-Face detection
A-Buffer method
BSP Tree
Octree
Image Space methods
Depth Buffer / Z-Buffer method
Scan-Line method
Ray-Casting
Mixed
Depth Sorting
Area Subdivision
VISIBLE SURFACE DETECTION
Two fundamental principles:

Sorting: Used to compare depths and order


individual surfaces in a scene according to
the distance from the view plane.

Coherence: Used to take advantage of


regularities in a scene.
VISIBLE SURFACE DETECTION
•From a given viewing direction if a face is not visible
it is considered as backface.
•Sometimes the name used is ‘backface culling’.
•Used to remove unseen polygons from convex,
closed polyhedron

•Does not completely solve hidden surface


problem since one polyhedron may
obscure another
VISIBLE SURFACE DETECTION
Back-Face Detection (OS):
If the viewing direction is along the normal vector
direction to a face, then we are seeing the backside
of it. A point P(x,y) is an inside point if

When an inside point is along the line of sight to the


surface, the polygon must be a back face.
If V=(0,0,vz) and N=(A,B,C)
The polygon is a back face if

Since the viewing direction is along the negative


z-direction, the polygon face is a backface if c≤0.
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS):

Object depth is measured from the view plane along the z-axis of a viewing
system.
Each surface of a scene is processed separately one point at a time across the
surface.
This method can be applied to both planar or non-planar polygon surfaces.
Two buffers are used, Depth buffer and Refresh buffer.
Depth buffer is used to store depth values for each (x,y) position as surfaces
are processed, and the refresh buffer stores the intensity values for each position.
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS):
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS):
• Initialize
• For each buffer position (x,y)
– depth(x,y)=0,
– refresh(x,y)=background clolor

• For each polygon:


– Compute depth Z, for each (x,y) position on the
polygon
– If z > depth(x,y), then
• Depth (x,y)  Z
• refresh(x,y) color of polygon at (x,y)
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS):

• Calculate the z-value on a surface

• Incremental calculation
If z(x,y) is the depth value at position (x,y) then depth at the next position
(x+1,y) i.e. z(x+1,y) along the scan line can be obtained as
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS): Once we know the y-extents of the
polygon, we can start at a top vertex and
recursively calculate x-positions down a left
edge of the polygon as

For processing vertical edges m


Xk Xk+1
becomes infinity and the above
recursive equation reduces to
VISIBLE SURFACE DETECTION
Z-Buffer/Depth Buffer (IS):
 Advantages:
– Easy to implement
– No sorting of surfaces is required
– Polygons may be processed in any order
 Disadvantages:
– Requires two buffers , depth and refresh
– It can only find one visible surface at each
pixel position.
– It deals with only opaque surfaces
VISIBLE SURFACE DETECTION
A-Buffer/Depth Buffer (IS):

It is an extension to the depth-buffer method


A – anti-aliased, area-averaged,
accumulation-buffer method.
This method expands the depth-buffer so
that each position in the buffer can reference a
linked list of surfaces.
more than one surface intensity can be taken
into consideration.
VISIBLE SURFACE DETECTION
A-Buffer/Depth Buffer (IS):

• Each position in the A-buffer has two


fields
– Depth field: Stores a depth value
– Intensity field (stores surface data)
• RGB intensity components
• Opacity parameter (percent of
transparency)
• Depth
• Percent of area coverage
• Surface identifier
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
Extension of the scan-line algorithm for filling
polygon interiors
– For all polygons intersecting each scan
line
• Process from left to right
• Depth calculations for each
overlapping surface
• The intensity of the nearest position is
entered into the refresh buffer
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
• Active list
– Contain only edges across the current scan
line
– Sorted in order of increasing x
• Flag for each surface
– Indicate whether on or outside of the surface
– At the leftmost boundary of a surface
• The surface flag is turned on
– At the rightmost boundary of a surface
• The surface flag is turned off
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
Active list for scan line 1
– Edge table
• AB, BC, EH, and FG
• Between AB and BC, only
the flag for surface S1 is on
– No depth calculations
are necessary
– Intensity for surface S1 is
entered into the refresh buffer
• Similarly, between EH and FG,
only the flag for S2 is on
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
For scan lines 2, 3
– AD, EH, BC, and FG
• Between AD and EH,
only the flag for S1 is on
• Between EH and BC, the
flags for both surfaces are on
- Depth calculation is needed
- Intensity for S1 is loaded (if we assume that depth
for S1 is lesser than that of S2 ) into the refresh
buffer until BC
- Later S1 is off and intensity of S2 is stored until FG
– Take advantage of coherence
• Pass from one scan line to next
• Scan line 3 has the same active list as scan line 2
• Unnecessary to make depth calculations between EH and BC
VISIBLE SURFACE DETECTION
Scan Line Method (IS):
 Advantages:
– Any number of overlapping surfaces can
be processed
– Takes advantage of coherence principle
 Disadvantages:
– Does not work for surfaces that cut
through or cyclically overlap each other.
VISIBLE SURFACE DETECTION
BSP TREE Method (OS):

A region of space partitioned The corresponding BSP Tree


using planes P1 and P2
Summary

• Classification of Visible surface detection methods.


• Learnt Visible surface detection Methods in both OS and IS.

You might also like