0% found this document useful (0 votes)
416 views2 pages

Hidden Surface, Visible Surface & Hidden-Surface Removal Problem

The document discusses hidden surface removal and the z-buffer algorithm. It explains that closer objects obscure farther objects and the surfaces not visible are hidden. The identification and removal of hidden surfaces is called the hidden surface problem. The z-buffer algorithm uses depth comparisons to determine which points are visible at each pixel by storing the closest z-value in the z-buffer at each pixel location. It works by initializing the z-buffer to the maximum depth, scan converting polygons while comparing polygon z-values to the z-buffer, and updating the z-buffer and pixel color where a polygon is closer.

Uploaded by

Manish
Copyright
© © All Rights Reserved
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)
416 views2 pages

Hidden Surface, Visible Surface & Hidden-Surface Removal Problem

The document discusses hidden surface removal and the z-buffer algorithm. It explains that closer objects obscure farther objects and the surfaces not visible are hidden. The identification and removal of hidden surfaces is called the hidden surface problem. The z-buffer algorithm uses depth comparisons to determine which points are visible at each pixel by storing the closest z-value in the z-buffer at each pixel location. It works by initializing the z-buffer to the maximum depth, scan converting polygons while comparing polygon z-values to the z-buffer, and updating the z-buffer and pixel color where a polygon is closer.

Uploaded by

Manish
Copyright
© © All Rights Reserved
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

Hidden surface, visible surface & hidden-surface removal problem:-

If two opaque objects are in the line of sight then the closer object will be visible and far object
will be hidden from viewer. The surface that are seen to the viewer is visible surface and surface that are
not visible is hidden surface. The surfaces that are blocked or hidden from view must be “removed” in
order to construct a realistic view of 3D scene. The identification and removal of such surfaces is known
as hidden-surface problem.

Depth Comparisons:-
The two points P1(x1,y1,z1) and P2(x2,y2,z2), does either point Obscure or in front of each other
depends on conditions

1. If P1 and P2 are on same line?


2. If not, a depth comparison decides which point is in front of other.

In orthographic parallel projection onto xy plane, P1 and P2 are on same projectors if x1=x2 and y1=y2. In
this case if z1<z2 then P1obscures P2. For perspective projection the calculations are more complex that
can be avoided by transforming all three-dimensional objects so that parallel projections of the
transformed object is equivalent to the perspective projection of the original object.

Z-Buffer Algorithm:-
A point in the display space is “seen” from pixel (x, y) if the projection of the point is scan converted to
this pixel. The Z-buffer algorithm essentially keeps track of the smallest z coordinate (also called the depth
value) of those points which are seen from pixel (x, y). Z-buffer is used to store these Z values.

Let Zbuf(x, y) denote the current depth value that is stored in the Z-buffer at pixel (x, y). Then working with
the (already) projected polygons P of the scene to be rendered.

The Z-buffer algorithm consists of the following steps.

1. Initialize the screen to a background color. Initialize the Z-buffer to the depth of the back
clipping plane. That is, set Zbuf(x,y)=Zback, for every pixel (x,y).
2. Scan-convert each (projected) polygon P in the scene and during this scan-conversion process,
for each pixel (x,y) that lies inside the polygon:
(i.) Calculate Z(x,y), the depth of the polygon at pixel (x,y).
(ii.) If Z(x,y)<Zbuf(x,y), set Zbuf(x,y)= Z(x,y) and set the pixel value at (x, y) to the color of the
polygon P at (x, y). In the following figure points P1 and P2 are both scan-converted to
pixel (x, y); however, since z1<z2, P1 will obscure P2 and the z value at P1 i.e. z1, will be
stored in the Z-buffer.

Remark: The Z-buffer algorithm requires Z-buffer memory storage proportional to the number of pixels
on the screen.
References:

• Donald Hearn and M. Pauline Baker, “Computer Graphics C Version‟, Prentice – Hall of India

• Zhigang Xiang and Roy A Plastok, “Computer Graphics” Tata McGraw Hill Education Private
Limited, Second Edition

You might also like