Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
1. Visible Surface Detection
• When we view a picture containing non-transparent objects and
surfaces, then we cannot see those objects from view which are
behind from objects closer to eye. We must remove these hidden
surfaces to get a realistic screen image. The identification and
removal of these surfaces is called Hidden-surface problem.
• There are two approaches for removing hidden surface problems
− Object-Space method and Image-space method. The Object-
space method is implemented in physical coordinate system and
image-space method is implemented in screen coordinate system.
• When we want to display a 3D object on a 2D screen, we need to
identify those parts of a screen that are visible from a chosen viewing
position.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
2. • This method is developed by Cutmull. It is an image-space approach. The basic idea is to test the Z-
depth of each surface to determine the closest visible surface.
• In this method each surface is processed separately one pixel position at a time across the surface.
The depth values for a pixel are compared and the closest smallest z surface determines the color to
be displayed in the frame buffer.
• It is applied very efficiently on surfaces of polygon. Surfaces can be processed in any order. To
override the closer polygons from the far ones, two buffers named frame buffer and depth buffer,
are used.
• Depth buffer is used to store depth values for x,y position, as surfaces are processed 0≤depth≤1.
• The frame buffer is used to store the intensity value of color value at each position x,y.
• The z-coordinates are usually normalized to the range [0, 1]. The 0 value for z-coordinate indicates
back clipping pane and 1 value for z-coordinates indicates front clipping pane.
Z−Buffer Method
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
3. Z−Buffer Method
Advantages
•It is easy to implement.
•It reduces the speed problem if implemented in
hardware.
•It processes one object at a time.
Disadvantages
•It requires large memory.
•It is time consuming process.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
First of all, initialize the depth of each pixel.
i.e, d(i, j) = infinite (max length)
Initialize the color value for each pixel
as c(i, j) = background color
for each polygon, do the following steps :
for (each pixel in polygon's projection)
{
find depth i.e, z of polygon
at (x, y) corresponding to pixel (i, j)
if (z < d(i, j))
{
d(i, j) = z;
c(i, j) = color;
}
}
4. Scan-Line Method
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
This algorithm is based on the Image-space method and concept of coherence. As its name suggests itself
Scan-line algorithm, so it processes one line at a time rather than processing one pixel(a point on raster
display) at a time. The algorithm works as follows:
Here each point at which the scan- line intersects the polygon surfaces are examined(processed) from left to
right and in this process.
The depth calculation (if there are overlapping surfaces found) is performed to identify the Hidden
region(Visible surface) of the polygons which is nearer to the viewing plane.
As soon as the visible surfaces(Hidden surfaces) are identified then the corresponding color-intensity values
are updated into the refresh buffer(Frame buffer) if and only if the Flag of the corresponding surface is on.
This algorithm works efficiently with one or more than one polygon surface and this algorithm is just an
extension of the Scan line algorithm of Polygon filling.
6. Scan-Line Method
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Here, two overlapped polygons are given which are intersected
by three Scan-lines S1, S2, S3 respectively. So, What happens if
the Scan-line algorithm is applied in order to identify the
Hidden surface(visible surface)?
1. First, examine the scanline(S1), whose,
Active edge table (Aet) contains: [AD,BC,RS,PQ], and
The flag is set to “on” for surface(S1) and surface(S2) and the flag set
“off” for the region between BX and RX as it’s an outer region of the
polygon’s surface and not to be projected at view-port(display
devices), now
Drop the color-intensities of the corresponding surfaces into the
frame buffer(refresh buffer).
7. Scan-Line Method
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
2. Then, process the scanline(S2), whose,
Active edge table (Aet) contains: [AD,BC,RS,PQ], and
The flag is set to “on” for surface(ABCD) and surface(PQRS),
Both of the polygons surfaces are overlapping each other so for
this overlapped region which of the surface intensity should be
taken into account? So to answer this calculates the
depth(Zmin) of both surface(S1) and surface(S2) of this
overlapped portion, next,
If depth(S1)>depth(S2), then the Flag of surface S1=” on” and
intensity of surface S1 will be considered else S2, now
Drop the color-intensities of the corresponding surfaces whose
flag is set to on into the frame buffer(refresh buffer).