Module-V - Visible Surface Detection Methods
Module-V - Visible Surface Detection Methods
Module-V - Visible Surface Detection Methods
Deepika Sahu
CSE Department
Korea University
Abstract
Visible Surface detection methods or hidden surface
elimination methods is the process of identifying visible
parts of a scene from a viewpoint
Numerous algorithms
• More memory - storage
• More processing time – execution time
• Only for special types of objects - constraints
Object-space methods
• Compares objects and parts of objects to each other within
the scene definition to determine which surfaces are visible
Image-space methods
• Point by point at each pixel position on the projection
plane
Korea University
Back-Face Detection
A fast and simple object-space method for locating
back faces of a polyhedron which is based on the inside
- outside tests
Inside-outside test
V N 0 N = (A, B, C)
V
Advantages
Limitation:
It cannot be applicable for all situation like
overlapping case (if two objects are overlapping)
or two faces of a single object is overlapping.
Back-face detection can be expected to eliminate
about half of the polygon surfaces in a scene
from further visibility tests.
Depth-Buffer Method
Korea University
Characteristics
Commonly used image-space approach
Compares depths of each pixel on the projection plane
• Referred to as the z-buffer method
• Here the object depth is usually measured from the view plane
along the z-axis of a viewing system.
Usually applied to scenes of polygonal surfaces
• Depth values can be computed very quickly
Yv
• Easy to implement S3
S2
S1
(x, y)
Xv
Zv
Korea University
xb x p
z p zb zb z a
xb xa
y3
z3
Advantages:-
• Easy Implementation
• No sorting of surfaces
• Good rendering algorithm with polygon models
Limitations
• Suitable for opaque objects and not suitable for transparent
objects.
• Additional Buffer: Large number of memory is required as we
are using image space approach
• Aliasing effect
• Objects are processed in arbitrary order, so that a color can be
computed for a surface point that is alter replaced by a closer
surface
A-Buffer Method
Characteristics Korea University
information for each pixel in addition to depth for transparency
or anti-aliasing (high-end movies, etc.).
Each position in the A-buffer element stores:
Algorithm(1 / 2)
Algorithm
For transparent surfaces and filter based anti-aliasing:
Algorithm (1): filling buffer
at each pixel, maintain a pointer to a list of polygons
sorted by depth.
when filling a pixel:
• if polygon is opaque and covers pixel, insert into list, removing all
polygons farther away
• if polygon is opaque and only partially covers pixel, insert into list,
but don’t remove farther polygons
Algorithm (2): rendering pixels
at each pixel, traverse buffer using brightness values in polygons to fill.
values are used for either for calculations involving transparency or for filter
ing for aliasing
Korea University
Cont..
Characteristics
Edge table
• Coordinate endpoints for each line
• Slope of each line
• Pointers into the polygon table
Identify the surfaces bounded by each line
Polygon table
• Coefficients of the plane equation for each surface
• Intensity information for the surfaces
• Pointers into the edge table
Korea University
Active list
• Contain only edges across the current scan line
• Sorted in order of increasing x
Flag for each surface
• Indicate whether inside 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
Example Korea University
D
G
necessary xv
Coherence
Advantage of Coherence
Drawback
Only if surfaces don’t cut through or otherwise cyclically
overlap each other
• If any kind of cyclic overlap is present
Divide the surfaces
Depth-Sorting Method
Korea University
Operations
Algorithm
Referred to as the painter’s algorithm
• In creating an oil painting
First paints the background colors
The most distant objects are added
Then the nearer objects, and so forth
Finally, the foregrounds are painted over all objects
• Each layer of paint covers up the previous layer
Process
• Sort surfaces according to their distance from the view plane
• The intensities for the farthest surface are then entered into the
refresh buffer
• Taking each succeeding surface in decreasing depth order, we
paint the surface intensities of the previously processed surfaces.
Cont.. Korea University
Overlapping Tests
Test2 : Surface S is completely behind the overlapping
surface relative to the viewing position
• S1 is completely behind/inside the overlapping
surface S2 using plane equations:
Ax +By+Cz+D < 0
• Test2 is passed, scan convert S1 and then S2.
• If test2 fails, then go to test3.
Korea University
Overlapping Tests
Test 3: The overlapping surface is completely in front
of S relative to the viewing position
• S1 is not completely behind S2, so Test2 fails.
• Overlapping surface S2 is completely front/outside of S1,
so Test3 passed.
i.e. Ax+By+Cz+D > 0 – S1 is front/outside of S2
else Ax+By+Cz+D < 0 - S1 is behind/inside of S2
• Scan convert S1 and then S2
• If the test3 fails, then go to test4.
Korea University
Overlapping Tests
Test 4: The projections of the two surfaces onto the
viewplane do not overlap.
To check this find whether Ei intersects Ej or not where Ei
and Ej are the edges of overlapping polygons.
Korea University
Overlapping Tests
S’
xv xv
(1) (2)
zv zv
S S
S’ S’
xv xv
(3) (4)
zv zv
Korea University
Surface Reordering
S’’
S
S’ S S’
xv xv
<S S’> <S S’’, then S’’ S’>
zv zv
Korea University
Drawback
If two or more surfaces alternately obscure each
other
• Infinite loop
• Flag any surface that has been reordered to a farther
depth
It can’t be moved again
• If an attempt to switch the surface a second time
Divide it into two parts to eliminate the cyclic loop
The original surface is then replaced by the two
new surfaces