Module 4
Module 4
Module 4
• Device independent
• Processing time
• Memory requirements
• Easy to implement in hardware .
Depending upon whether they deal with object definitions or their projected images the
surface detection algorithm is classified into:
Object space method: compares objects and part of objects to each other within the scene
to determine which surface to display as visible surface.
Image space method: here visibility is determined point by point at each pixel position
on the projection plane.
Back-face detection
V.N = VzC
Viewing direction along negative z axis ,the polygon is back face if C < = 0.
1
Module 4
For polygons that are partially at the back cannot be determined with this method and
requires additional test.
Depth-Buffer method
2
Module 4
depth value can be calculated from the plane equation for the surface as
z = -Ax - By – D / C ----------------------(1)
After completing all values of x for a particular y value next value for y is
obtained by incrementing one to the previous value.this way the whole screen I
scaned one by one.
From equation (1) the depth value for next position (x+1,y) is obtained by
z’ = -A(x+1) – By – D/C
z’ = z – A/C
z’ = z + ((A/m) + B)/C
z’ = z + B/C
3
Module 4
A-Buffer method
• An extension of the depth-buffer for dealing with anti-aliasing, area-averaging,
transparency, and translucency.
• Each pixel references a linked list of surfaces.
• The transparent surface and the surfaces visible through that transparent surface.
• Each position in the A-buffer has two fields Depth field stores a (1)depth value
And (2)Surface data field.
• Surface data field contains : RGB intensity components.
Opacity parameter.
Depth.
Percent of area coverage.
Surface identifier.
Pointer to next surface.
4
Module 4
BSPTree method
5
Module 4
6
Module 4
• Once the tree is constructed, every root-to-leaf path describes a single convex
subspace.
7
Module 4
Octree methods
8
Module 4
• Octree nodes are projected onto the viewing surface in a front-to-back order.
• Any surfaces toward the rear of the front octants (0,1,2,3) or in the back octants
(4,5,6,7) may be hidden by the front surfaces.
• With the numbering method (0,1,2,3,4,5,6,7), nodes representing octants 0,1,2,3
for the entire region are visited before the nodes representing octants 4,5,6,7.
• Similarly the nodes for the front four sub octants of octant 0 are visited before the
nodes for the four back sub octants.
• When a colour is encountered in an octree node, the corresponding pixel in the
frame buffer is painted only if no previous color has been loaded into the same
pixel position.
• In most cases, both a front and a back octant must be considered in determining
the correct color values for a quadrant. But
- If the front octant is homogeneously filled with some color,
we do not process the back octant
- If the front is empty, it is necessary only to process the rear
octant.
- If the front octant has heterogeneous regions, it has to be
subdivided and the sub-octants are handled recursively.
Goraud shading
9
Module 4
• Gouraud shading actually first interpolates between vertices and assigns values
along triangle edges
• then it interpolates across the scan line based on the interpolated edge crossing
values.
• One of the main advantages to Gouraud is that it smoothes out triangle edges on
mesh surfaces, giving objects a more realistic appearance.
• The following calculations are made in this method
o determine average unit normal vector at each polygon
vertex
o apply illumination model at each vertex.
o Linearly interpolate the vertex intensities over the surface.
(REFER TEXT FOR DETAILS OF INETNSITY INTERPOLATION ALONG THE
EDGES)
Phond shading
The lighting model does not have to be the Phong lighting model...
Normal interpolation is nominally done by vector addition and renormalization.
Several ``fast'' approximations are possible.
The view and light vectors may also be interpolated or approximated.
Problems with Phong shading:
10