Unit 5
Unit 5
Algorithm
Step-1 − Set the buffer values −
Depthbuffer (x, y) = 0
Framebuffer (x, y) = background color
Step-2 − Process each polygon (One at a time)
For each projected (x, y) pixel position of a polygon, calculate
depth z.
If Z > depthbuffer (x, y)
Compute surface color,
set depthbuffer (x, y) = z,
framebuffer (x, y) = surfacecolor (x, y)
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.
Scan-Line Method
It is an image-space method to identify visible surface. This
method has a depth information for only single scan-line. In
order to require one scan-line of depth values, we must group
and process all polygons intersecting a given scan-line at the
same time before processing the next scan-line. Two
important tables, edge table and polygon table, are
maintained for this.
The Edge Table − It contains coordinate endpoints of each
line in the scene, the inverse slope of each line, and pointers
into the polygon table to connect edges to surfaces.
The Polygon Table − It contains the plane coefficients,
surface material properties, other surface data, and may be
pointers to the edge table.
Area-Subdivision Method
The area-subdivision method takes advantage by locating
those view areas that represent part of a single surface. Divide
the total viewing area into smaller and smaller rectangles until
each small area is the projection of part of a single visible
surface or no surface at all.
Continue this process until the subdivisions are easily
analyzed as belonging to a single surface or until they are
reduced to the size of a single pixel. An easy way to do this is
to successively divide the area into four equal parts at each
step. There are four possible relationships that a surface can
have with a specified area boundary.
Surrounding surface − One that completely encloses
the area.
Overlapping surface − One that is partly inside and
partly outside the area.
Inside surface − One that is completely inside the area.
Outside surface − One that is completely outside the
area.
Back-Face Detection
A fast and simple object-space method for identifying the
back faces of a polyhedron is based on the "inside-outside"
tests. A point (x, y, z) is "inside" a polygon surface with plane
parameters A, B, C, and D if When an inside point is along the
line of sight to the surface, the polygon must be a back face
(we are inside that face and cannot see the front of it from our
viewing position).
We can simplify this test by considering the normal
vector N to a polygon surface, which has Cartesian
components (A, B, C).
In general, if V is a vector in the viewing direction from the
eye (or "camera") position, then this polygon is a back face if
V.N > 0
Furthermore, if object descriptions are converted to projection
coordinates and your viewing direction is parallel to the
viewing z-axis, then −
V = (0, 0, Vz) and V.N = VZC
So that we only need to consider the sign of C the component
of the normal vector N.
In a right-handed viewing system with viewing direction
along the negative ZVZV axis, the polygon is a back face if C
< 0. Also, we cannot see any face whose normal has z
component C = 0, since your viewing direction is towards that
polygon. Thus, in general, we can label any polygon as a back
face if its normal vector has a z component value −
C <= 0
3. Specular Reflection
When light falls on any shiny or glossy surface most of it is
reflected back, such reflection is known as Specular
Reflection. Phong Model is an empirical model for Specular
Reflection which provides us with the formula for calculation
the reflected intensity Ispec.
Introduction of Shading
Shading is referred to as the implementation of the
illumination model at the pixel points or polygon surfaces of
the graphics objects.
Shading model is used to compute the intensities and colors to
display the surface. The shading model has two primary
ingredients: properties of the surface and properties of the
illumination falling on it. The principal surface property is its
reflectance, which determines how much of the incident light
is reflected. If a surface has different reflectance for the light
of different wavelengths, it will appear to be coloured.
An object illumination is also significant in computing
intensity. The scene may have to save illumination that is
uniform from all direction, called diffuse illumination.
Shading models determine the shade of a point on the surface
of an object in terms of a number of attributes. The shading
Mode can be decomposed into three parts, a contribution from
diffuse illumination, the contribution for one or more specific
light sources and a transparency effect. Each of these effects
contributes to shading term E which is summed to find the
total energy coming from a point on an object. This is the
energy a display should generate to present a realistic image
of the object. The energy comes not from a point on the
surface but a small area around the point.
Gouraud shading
This Intensity-Interpolation scheme, developed by Gouraud
and usually referred to as Gouraud Shading, renders a polygon
surface by linear interpolating intensity value across the
surface. Intensity values for each polygon are coordinate with
the value of adjacent polygons along the common edges, thus
eliminating the intensity discontinuities that can occur in flat
shading.
Each polygon surface is rendered with Gouraud Shading by
performing the following calculations:
1. Determining the average unit normal vector at each
polygon vertex.
2. Apply an illumination model to each vertex to determine
the vertex intensity.
3. Linear interpolate the vertex intensities over the surface
of the polygon.
At each polygon vertex, we obtain a normal vector by
averaging the surface normals of all polygons staring that
vertex as shown in fig:
Then we can obtain the intensity along this edge for the next
scan line, Y-1 as