SHADING



                              Shading is referred because the implementation of illumination model at the pixel
points or polygon surfaces of the graphics objects .

Constant-Intensity Shading

A fast and easy method for rendering an object with polygon surfaces is constant intensity shading, also called flat shading. during this method, one intensity is calculated for every polygon. All points over the surface of the polygon are then displayed with the identical intensity value. Constant shading is useful for quickly displaying the final appearance of a curved surface.

In general, flat shading of polygon facets provides an accurate rendering for an object if all of the subsequent assumptions are valid. The object may be a polyhedron and isn't an approximation of an object with a curved surface. All light sources illuminating the objects are sufficiently removed from the surface in order that N . L and also the attenuation function are constant over the surface (where N is that the unit normal to a surface and L is that the unit direction vector to the purpose source of illumination from an edge on the surface). The viewing position is sufficiently removed from the surface in order that V . R is constant over the surface. (where V is that the unit vector pointing to the viewer from the surface position and R represent unit vector within the direction of ideal specular reflection).

Gouraud Shading

This intensity-interpolation scheme, developed by Gouraud and customarily mentioned as Gouraud shading, renders a polygon surface by linearly interpolating intensity values across the surface. Intensity values for every polygon are matched with the values of adjacent polygons along the common edges, thus eliminating the intensity discontinuities that may occur in flat shading. Each polygon surface is rendered with Gouraud shading by performing the subsequent calculations:
1.Determine the typical unit normal vector at each polygon vertex.
2.Apply an illumination model to every vertex to calculate the vertex intensity. 3.Linearly interpolate the vertex intensities over the surface of the polygon.
At each polygon vertex, we obtain a traditional vector by averaging the surface normal’s of all polygons starting that vertex.



Thus, for any vertex position V, we obtain the unit vertex normal with the calculation



once we've the vertex normal’s, we are able to determine the intensity at the vertices from a lighting model. the traditional vector at vertex V is calculated because the average of the surface normal’s for every polygon sharing that vertex.

Following picture demonstrates the following step:

Interpolating intensities along the polygon edges. for every scan line, the intensity at the intersection of the scan line with a polygon edge is linearly interpolated from the intensities at the sting endpoints. For the instance in picture, the polygon edge with endpoint vertices at positions 1 and a pair of is intersected by the scan line at point 4. a quick method for obtaining the intensity at point 4 is to interpolate between intensities I 1 , and that i 2 using only the vertical displacement of the scan line:





Similarly, intensity at the proper intersection of this scan line (point 5) is interpolated from intensity values at vertices 2 and three. Once these bounding intensities are established for a scan line, an internal point (such as point P in Previous Fig(3)) is interpolated from the bounding intensities at points 4 and 5 as




Incremental calculations are wont to obtain successive edge intensity values between scan lines and to get successive intensities along a scan line. As shown in following  picture,




If the intensity at edge position (x,y) is interpolated as,




then we are able to obtain the intensity along this edge for the following scan line as,



Similar calculations are wont to obtain intensities at successive horizontal pixel positions along each scan line. When surfaces are to be rendered in color, the intensity of every color component is calculated at the vertices. Gouraud shading is combined with a hidden-surface algorithm to fill within the visible polygons along each scan line.
Gouraud shading removes the intensity discontinuities related to the constant-shading model, but it's another deficiencies. Highlights on the surface are sometimes displayed with anomalous shapes, and also the linear intensity interpolation can cause bright or dark intensity streaks, called Mach bands, to look on the surface. These effects is reduced by dividing the surface into a greater number of polygon faces or by using other methods, like Phong shading, that need more calculations.

Phong Shading

A more accurate method for rendering a polygon surface is to interpolate normal vectors, so apply the illumination model to every surface point. This method, developed by Phong Bui Tuong, is named Phong shading, or normal vector interpolation shading. It displays more realistic highlights on a surface and greatly reduces the Mach-band effect. A polygon surface is rendered using Phong shading by closing the subsequent steps:

1.Determine the typical unit normal vector at each polygon vertex.
2.Linearly & interpolate the vertex normal’s over the surface of the polygon. 
3.Apply an illumination model along each scan line to calculate projected pixel intensities for the surface points.

Interpolation of surface normals along a polygon edge between two vertices is illustrated in picture. the traditional vector N for the scan-line intersection along the sting between vertices 1 and a pair of is obtained by vertically interpolating between edge endpoint normals:

Intensity calculations using an approximated normal vector at each point along the scan line produce more accurate results than the direct interpolation of intensities, as in Gouraud shading. The trade-off, however, is that Phong shading requires considerably more calculations.

Comments

POPULAR POSTS

POPULAR POSTS