![]() |
![]() |
|
![]() |
![]() |
Encyclopedia :
P :
PH :
PHO :
Phong shading |
|
|
Phong shadingThe term Phong shading is used indiscriminately to describe both an illumination model and an interpolation method in 3D computer graphics.Phong illumination or reflection modelPhong reflection can produce a certain degree of realism in three-dimensional objects by combining three elements - diffuse, specular and ambient for each considered point on a surface. It has several assumptions - all lights are points, only surface geometry is considered, only local modelling of diffuse and specular, specular colour is the same as light colour, ambient is a global constant. Diffuse,
For multiple light sources,
Specular (highlight producing),
Combining diffuse and specular is sufficient for local accuracy. To mimic global conditions an ambient element is added to give general illumination, usually as a constant value
Phong interpolationAs a rendering method, Phong shading can be regarded as an improved version of Gouraud shading that provides a better approximation to reality by approximating the Phong shading model. The main problem with Gouraud shading is that when a specular highlight occurs near the center of a large triangle, it will usually be missed entirely. This problem is fixed by Phong shading. Some argue that using smaller triangles fixes the problem of Gouraud shading, with respect to specular highlights. Others counter that Phong shading is better able to handle large triangles, and that in any case, very sharp specular highlights would require tiny triangles. The truth is somewhere in between, and it pays to remember that Phong interpolation does very little to soften the abrupt change in color gradient near the edges of triangles. In fact, the improved handling of specular highlights can worsen this problem. We are given three vertices in two dimensions, v1, v2 and v3, as well as normals for each vertex n1, n2 and n3; we assume these are of unit length. As in Gouraud shading, we linearly interpolate a normal N across the surface of the triangle, from the three given normals. This is done, as in Gouraud shading, for each pixel in the triangle, and at each pixel we normalize N and use it in the Phong illumination model to obtain the final pixel color. In some modern hardware, variants of this algorithm are called "pixel shading." It usually means that the lighting calculations can be done per-pixel, and that the lighting variables are interpolated across the triangle. See also
|
|
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License. |
|
| © 2008 Chamas Enterprises Inc. |