0% found this document useful (0 votes)
773 views

Hidden Surface Removal

This document discusses various algorithms for hidden surface and hidden line removal in 3D computer graphics. It describes: 1) Hidden line removal, which removes hidden lines covered by surfaces without removing hidden faces. 2) Four common hidden surface removal algorithms - the z-buffer algorithm, scan line z-buffer algorithm, ray tracing, and Warnock algorithm. These algorithms sort surfaces or use a z-buffer to determine visibility. 3) Additional techniques for shading surfaces like flat shading, smooth shading using Gouraud and Phong shading models to add more realistic lighting effects.

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
773 views

Hidden Surface Removal

This document discusses various algorithms for hidden surface and hidden line removal in 3D computer graphics. It describes: 1) Hidden line removal, which removes hidden lines covered by surfaces without removing hidden faces. 2) Four common hidden surface removal algorithms - the z-buffer algorithm, scan line z-buffer algorithm, ray tracing, and Warnock algorithm. These algorithms sort surfaces or use a z-buffer to determine visibility. 3) Additional techniques for shading surfaces like flat shading, smooth shading using Gouraud and Phong shading models to add more realistic lighting effects.

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

HIDDEN SURFACE AND HIDDEN LINE REMOVAL

Hidden Line Removal


Hidden line removal is an extension of wireframe model rendering where lines (or segments of
lines) covered by surfaces are not drawn.
This is not the same as hidden face removal since this involves depth and occlusion while the
other involves normals.
- assumes that objects are modeled with lines.
- lines are created where surfaces meet
- if only the visible surfaces are drawn, the invisible lines are automatically eliminated.
Hidden surface removal
One of the difficult problems in computer graphics is the removal of hidden
surfaces from the images of solid objects. In Fig. (a) an opaque cube is shown in wire frame
representation. Edges 15, 48, 37, 14, 12, 23, 58 and 87 are visible whereas edges 56, 67 and 26
are not visible. Correspondingly, surfaces 1265, 2673 and 5678 are not visible since the object is
opaque. The actual representation of the cube must be as shown in Fig. b

Fig. a

Fig. b

Hidden surface removal algorithms


1. Z-BUFFER ALGORITHM
This scheme was developed by Catmull using Sutherlands classification scheme. In this
technique, pixels interior to a polygon are shaded and their depth is evaluated by interpolation
from Z-values of the polygon vertices after the viewing transformation has been applied. For
every pixel, (X, Y) values are the pixel co-ordinates and Z value is the viewing space depth. For
each interior polygon point a search is carried out to determine the minimum Z value. This
search is conveniently implemented using a Z-buffer that holds for a current point (X, Y) the
smallest Z value so far encountered. The Z-buffer algorithm has the advantage of simplicity. It
handles scenes of any complexity. There is also no computation required for depth sort. The
storage space required however is large. This could be reduced by pre-processing, so that
polygons nearest the viewpoint are processed first.

2. SCAN LINE Z-BUFFER ALGORITHM


This is a special case of Z-buffer algorithm. In this algorithm for each scan line the frame
buffer is initialized to the back ground and Z buffer to the minimum Z. The intersection of the
scan line with the two dimensional projection of each polygon is found. The depth of each pixel
on the scan line between each pair of the intersection is determined. If the pixel depth is greater
than that in the Z-buffer then this line segment is currently visible.
A spanning scan line algorithm, instead of solving the hidden surface removal on a
pixel-by-pixel basis using incremental Z calculation, uses spans along the scan line over which
there is no depth conflict. Consider the three dimensional screen space shown in Fig. A scan line
algorithm moves a scan line plane down the Y-axis. This plane, parallel to the XOZ plane,
intersects the objects in the scene and reduces the hidden surface problem to a 2-D space. The
line segments obtained through the intersection are then analyzed to detect hidden surfaces. This
is done by considering the spans which form part of a line segment that is contained between
edge intersections of all active polygons.

3. RAY TRACING
Ray tracing is a technique for generating an image by tracing the path of light through
pixels in an image plane and simulating the effects of its encounters with virtual objects. The
technique is capable of producing a very high degree of visual realism, usually higher than that
of typical scan line rendering methods, but at a greater computational cost. Although not a
hidden surface removal algorithm as such, it implicitly solves the hidden surface
removal problem by finding the nearest surface along each view-ray. Effectively this
is equivalent to sorting all the geometry on a per pixel basis.

4. WARNOCK ALGORITHM
The Warnock algorithm is a hidden surface algorithm invented by John Warnock that
is typically used in the field of computer graphics. It solves the problem of rendering a

complicated image by recursive subdivision of a scene until areas are obtained that is trivial to
compute. In other words, if the scene is simple enough to compute efficiently then it is rendered;
otherwise it is divided into smaller parts which are likewise tested for simplicity. The inputs are a
list of polygons and a viewport. The best case is that if the list of polygons is simple, and then
draws the polygons in the viewport. Simple is defined as one polygon (then the polygon or its
part is drawn in appropriate part of a viewport) or a viewport that is one pixel in size (then that
pixel gets a color of the polygon closest to the observer). The continuous step is to split the
viewport into 4 equally sized quadrants and to recursively call the algorithm for each quadrant,
with a polygon list modified such that it only contains polygons that are visible in that quadrant

4. Painter's algorithm
The idea behind the Painter's algorithm is to draw polygons far away from the eye first, followed
by drawing those that are close to the eye. Hidden surfaces will be written over in the image as
the surfaces that obscure them are drawn.
The concept is to map the objects of our scene from the world model to the screen somewhat like
an artist creating an oil painting. First she paints the entire canvas with a background colour.
Next, she adds the more distant objects such as mountains, fields, and trees. Finally, she creates
the foreground with "near" objects to complete the painting. Our approach will be identical. First
we sort the polygons according to their z-depth and then paint them to the screen, starting with
the far faces and finishing with the near faces.
The algorithm initially sorts the faces in the object into back to front order. The faces are then
scan converted in this order onto the screen. Thus a face near the front will obscure a face at the
back by overwriting it at any points where their projections overlap. This accomplishes hiddensurface removal without any complex intersection calculations between the two projected faces.
The algorithm is a hybrid algorithm in that it sorts in object space and does the final rendering in
image space.
The basic algorithm :
1. Sort all polygons in ascending order of maximum z-values.
2. Resolve any ambiguities in this ordering.
3. Scan convert each polygon in the order generated by steps (1) and (2).

The necessity for step (2) can be seen in the simple case shown in Figure 1.1

Figure 1.1: Ambiguities in the Painter's algorithm.

B precedes A in order of maximum z but A should precede B in writing order.


At step (2) the ordering produced by (1) must be confirmed. This is done by making more
precise comparisons between polygons whose z-extents overlap.
Assume that polygon P is currently at the head of the sorted list, before scan converting it to the
frame-buffer it is tested against each polygon Q whose z-extent overlaps that of P. The following
tests of increasing complexity are then carried out:

1. If the x-extents of P and Q do not overlap then the polygons do not overlap, hence their
ordering is immaterial.
2. If the y-extents of P and Q do not overlap then the polygons do not overlap, hence their
ordering is immaterial.

3. If P is wholly on the far away side of Q then P is written before Q.


4. If Q is wholly on the viewing side of P then P is written before Q.
5. If the projections of P and Q do not overlap then the order P and Q in the list is
immaterial.
If any of these tests are satisfied then the ordering of P and Q need not be changed. However if
all five tests fail then it is assumed that P obscures Q and they are interchanged in the list. To
avoid looping in the case where P and Q inter-penetrate Q must be marked as having been moved
in the list.
When polygon Q which has been marked fails all tests again when tested against P then it must
be split into two polygons and each of these polygons treated separately. Q is split in the plane of
P.
Often the last test will not be done because it can be very complex for general polygons.

SHADING
Shading refers to the process of altering the color of an object/surface/polygon in the 3D
scene, based on its angle to lights and its distance from lights to create a photorealistic.

In

simple polygonal mesh models, the surface is represented by constant shading. To introduce
more realistic shading, incremental shading is necessary. Types of shading are,
i. Flat shading
ii. Smooth shading
FLAT SHADING
Flat shading is a lighting technique used in 3D computer graphics to shade each
polygon of an object based on the angle between the polygon's surface normal and the direction
of the light source, their respective colors and the intensity of the light source. It is usually used
for high speed rendering where more advanced shading techniques are too computationally
expensive. As a result of flat shading all of the polygon's vertices are colored with one color,

allowing differentiation between adjacent polygons. Specular highlights are rendered poorly with
flat shading: If there happens to be a large specular component at the representative vertex, that
brightness is drawn uniformly over the entire face. If a specular highlight doesnt fall on the
representative point, it is missed entirely. Consequently, the specular reflection component is
usually not included in flat shading computation
SMOOTH SHADING
In contrast to flat shading with smooth shading the color changes from pixel to pixel. It
assumes that the surfaces are curved and uses interpolation techniques to calculate the values of
pixels between the vertices of the polygons.
Types of smooth shading include:

Gouraud shading

Phong shading

GAURAUD SHADING
Gauraud Shading involves bilinear intensity interpolation over a polygon mesh. It is
restricted to diffuse component of the reflection model. The technique first calculates the
intensity at each vertex, assuming that the light source is at infinity. The intensity of the light
reflected over the polygonal surface can then be obtained by integrating the interpolation process
with the scan conversion process. The intensities at the edge of each scan line are calculated from
the vertex intensities and intensities along the scan line from these.
PHONG TECHNIQUE
Phong model overcomes some of the deficiencies of Gauraud technique and incorporates
specular reflection. The important feature of the Phong model is:
i. Vertex normals instead of vertex intensities are calculated by averaging normal vectors of the
surface that share the vertex.
ii. Bilinear interpolation is used for incremental interpolation of points interior to polygons.

iii. A separate intensity is evaluated for each pixel from the interpolated normals.

REFERENCES
[1] CAD CAM CIM text book -P. Radhakrishnan, S Subramanyan
[2] James Blinn, "Fractional Invisibility", IEEE Computer Graphics and Applications, Nov.
1988, pp. 77-84

You might also like