HOME

TheInfoList



OR:

The Phong reflection model (also called Phong illumination or Phong lighting) is an empirical model of the local illumination of points on a surface designed by the computer graphics researcher Bui Tuong Phong. In
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for t ...
, it is sometimes referred to as "Phong shading", particularly if the model is used with the interpolation method of the same name and in the context of pixel shaders or other places where a lighting calculation can be referred to as “
shading Shading refers to the depiction of depth perception in 3D models (within the field of 3D computer graphics) or illustrations (in visual art) by varying the level of darkness. Shading tries to approximate local behavior of light on the object ...
”.


History

The Phong reflection model was developed by Bui Tuong Phong at the
University of Utah The University of Utah (U of U, UofU, or simply The U) is a public research university in Salt Lake City, Utah. It is the flagship institution of the Utah System of Higher Education. The university was established in 1850 as the University of D ...
, who published it in his 1975 Ph.D. dissertation. It was published in conjunction with a method for interpolating the calculation for each individual
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the s ...
that is rasterized from a polygonal surface model; the interpolation technique is known as
Phong shading In 3D computer graphics, Phong shading, Phong interpolation, or normal-vector interpolation shading is an interpolation technique for surface shading invented by computer graphics pioneer Bui Tuong Phong. Phong shading interpolates surface nor ...
, even when it is used with a reflection model other than Phong's. Phong's methods were considered radical at the time of their introduction, but have since become the de facto baseline shading method for many rendering applications. Phong's methods have proven popular due to their generally efficient use of computation time per rendered pixel.


Description

Phong reflection is an empirical model of local illumination. It describes the way a surface reflects light as a combination of the
diffuse reflection Diffuse reflection is the reflection of light or other waves or particles from a surface such that a ray incident on the surface is scattered at many angles rather than at just one angle as in the case of specular reflection. An ''ideal'' dif ...
of rough surfaces with the
specular reflection Specular reflection, or regular reflection, is the mirror-like reflection of waves, such as light, from a surface. The law of reflection states that a reflected ray of light emerges from the reflecting surface at the same angle to the su ...
of shiny surfaces. It is based on Phong's informal observation that shiny surfaces have small intense
specular highlight A specular highlight is the bright spot of light that appears on shiny objects when illuminated (for example, see image on right). Specular highlights are important in 3D computer graphics, as they provide a strong visual cue for the shape of a ...
s, while dull surfaces have large highlights that fall off more gradually. The model also includes an ''ambient'' term to account for the small amount of light that is scattered about the entire scene. For each light source in the scene, components i_\text and i_\text are defined as the intensities (often as RGB values) of the specular and diffuse components of the light sources, respectively. A single term i_\text controls the ambient lighting; it is sometimes computed as a sum of contributions from all light sources. For each ''material'' in the scene, the following parameters are defined: :k_\text, which is a specular reflection constant, the ratio of reflection of the specular term of incoming light, :k_\text, which is a diffuse reflection constant, the ratio of reflection of the diffuse term of incoming light (
Lambertian reflectance Lambertian reflectance is the property that defines an ideal "matte" or diffusely reflecting surface. The apparent brightness of a Lambertian surface to an observer is the same regardless of the observer's angle of view. More technically, the su ...
), :k_\text, which is an ambient reflection constant, the ratio of reflection of the ambient term present in all points in the scene rendered, and :\alpha, which is a ''shininess'' constant for this material, which is larger for surfaces that are smoother and more mirror-like. When this constant is large the specular highlight is small. Furthermore, we have :\text, which is the set of all light sources, :\hat_m, which is the direction vector from the point on the surface toward each light source (m specifies the light source), :\hat, which is the normal at this point on the surface, :\hat_m, which is the direction that a perfectly reflected ray of light would take from this point on the surface, and :\hat, which is the direction pointing towards the viewer (such as a virtual camera). Then the Phong reflection model provides an equation for computing the illumination of each surface point I_\text: :I_\text = k_\text i_\text + \sum_ (k_\text (\hat_m \cdot \hat) i_ + k_\text (\hat_m \cdot \hat)^i_). where the direction vector \hat_m is calculated as the reflection of \hat_m on the surface characterized by the surface normal \hat using :\hat_m = 2(\hat_m\cdot \hat)\hat - \hat_m and the hats indicate that the vectors are normalized. The diffuse term is not affected by the viewer direction (\hat). The specular term is large only when the viewer direction (\hat) is aligned with the reflection direction \hat_m. Their alignment is measured by the \alpha power of the cosine of the angle between them. The cosine of the angle between the normalized vectors \hat_m and \hat is equal to their
dot product In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
. When \alpha is large, in the case of a nearly mirror-like reflection, the specular highlight will be small, because any viewpoint not aligned with the reflection will have a cosine less than one which rapidly approaches zero when raised to a high power. Although the above formulation is the common way of presenting the Phong reflection model, each term should only be included if the term's dot product is positive. (Additionally, the specular term should only be included if the dot product of the diffuse term is positive.) When the color is represented as RGB values, as often is the case in
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great deal ...
, this equation is typically modeled separately for R, G and B intensities, allowing different reflections constants k_\text, k_\text and k_\text for the different color channels.


Computationally more efficient alterations

When implementing the Phong reflection model, there are a number of methods for approximating the model, rather than implementing the exact formulas, which can speed up the calculation; for example, the Blinn–Phong reflection model is a modification of the Phong reflection model, which is more efficient if the viewer and the light source are treated to be at infinity. Another approximation that addresses the calculation of the exponentiation in the specular term is the following: Considering that the specular term should be taken into account only if its dot product is positive, it can be approximated as :\max(0, \hat_m \cdot \hat)^\alpha = \max(0, 1-\lambda)^ = \left(\max(0,1-\lambda)^\beta\right)^\gamma \approx \max(0, 1 - \beta \lambda)^\gamma where \lambda = 1 - \hat_m \cdot \hat, and \beta = \alpha / \gamma\, is a real number which doesn't have to be an integer. If \gamma is chosen to be a power of 2, i.e. \gamma = 2^n where n is an integer, then the expression (1 - \beta\lambda)^\gamma can be more efficiently calculated by squaring (1 - \beta\lambda)\ n times, i.e. :(1 - \beta\lambda)^\gamma \,=\, (1 - \beta\lambda)^ \,=\, (1 - \beta\lambda)^ \,=\, (\dots((1 - \beta\lambda)\overbrace^n. This approximation of the specular term holds for a sufficiently large, integer \gamma (typically, 4 or 8 will be enough). Furthermore, the value \lambda can be approximated as \lambda = (\hat_m - \hat)\cdot(\hat_m - \hat) / 2, or as \lambda = (\hat_m \times \hat)\cdot(\hat_m \times \hat) / 2. The latter is much less sensitive to normalization errors in \hat_m and \hat than Phong's dot-product-based \lambda = 1 - \hat_m \cdot \hat is, and practically doesn't require \hat_m and \hat to be normalized except for very low-resolved triangle meshes. This method substitutes a few multiplications for a variable exponentiation, and removes the need for an accurate reciprocal-square-root-based vector normalization.


Inverse Phong reflection model

The Phong reflection model in combination with
Phong shading In 3D computer graphics, Phong shading, Phong interpolation, or normal-vector interpolation shading is an interpolation technique for surface shading invented by computer graphics pioneer Bui Tuong Phong. Phong shading interpolates surface nor ...
is an approximation of shading of objects in real life. This means that the Phong equation can relate the shading seen in a
photograph A photograph (also known as a photo, image, or picture) is an image created by light falling on a photosensitive surface, usually photographic film or an electronic image sensor, such as a CCD or a CMOS chip. Most photographs are now creat ...
with the surface normals of the visible object. Inverse refers to the wish to estimate the surface normals given a rendered image, natural or computer-made. The Phong reflection model contains many parameters, such as the surface diffuse reflection parameter (
albedo Albedo (; ) is the measure of the diffuse reflection of solar radiation out of the total solar radiation and measured on a scale from 0, corresponding to a black body that absorbs all incident radiation, to 1, corresponding to a body that refl ...
) which may vary within the object. Thus the normals of an object in a photograph can only be determined, by introducing additional information such as the number of lights, light directions and reflection parameters. For example, we have a cylindrical object, for instance a finger, and wish to compute the normal N= _x, N_z/math> on a line on the object. We assume only one light, no specular reflection, and uniform known (approximated) reflection parameters. We can then simplify the Phong equation to: :I_p(x) = C_a + C_d (L(x) \cdot N(x)) With C_a a constant equal to the ambient light and C_d a constant equal to the diffusion reflection. We can re-write the equation to: :( I_p(x)- C_a ) / C_d = L(x) \cdot N(x) Which can be rewritten for a line through the cylindrical object as: :( I_p- C_a ) / C_d = L_x N_x + L_z N_z For instance if the light direction is 45 degrees above the object L= .71, 0.71/math> we get two equations with two unknowns. :( I_p- C_a ) / C_d = 0.71 N_x + 0.71 N_z :1 = \sqrt Because of the powers of two in the equation there are two possible solutions for the normal direction. Thus some prior information of the geometry is needed to define the correct normal direction. The normals are directly related to angles of inclination of the line on the object surface. Thus the normals allow the calculation of the relative surface heights of the line on the object using a line integral, if we assume a continuous surface. If the object is not cylindrical, we have three unknown normal values N= _x, N_y, N_z/math>. Then the two equations still allow the normal to rotate around the view vector, thus additional constraints are needed from prior geometric information. For instance in
face recognition A facial recognition system is a technology capable of matching a human face from a digital image or a video frame against a database of faces. Such a system is typically employed to authenticate users through ID verification services, an ...
those geometric constraints can be obtained using
principal component analysis Principal component analysis (PCA) is a popular technique for analyzing large datasets containing a high number of dimensions/features per observation, increasing the interpretability of data while preserving the maximum amount of information, and ...
(PCA) on a database of depth-maps of faces, allowing only surface normals solutions which are found in a normal population.


Applications

The Phong reflection model is often used together with
Phong shading In 3D computer graphics, Phong shading, Phong interpolation, or normal-vector interpolation shading is an interpolation technique for surface shading invented by computer graphics pioneer Bui Tuong Phong. Phong shading interpolates surface nor ...
to shade surfaces in
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for t ...
software. Apart from this, it may also be used for other purposes. For example, it has been used to model the reflection of
thermal radiation Thermal radiation is electromagnetic radiation generated by the thermal motion of particles in matter. Thermal radiation is generated when heat from the movement of charges in the material (electrons and protons in common forms of matter) is ...
from the Pioneer probes in an attempt to explain the Pioneer anomaly.


See also

* List of common shading algorithms * Blinn–Phong shading model – alteration of the Phong reflection model to trade precision with computing efficiency *
Phong shading In 3D computer graphics, Phong shading, Phong interpolation, or normal-vector interpolation shading is an interpolation technique for surface shading invented by computer graphics pioneer Bui Tuong Phong. Phong shading interpolates surface nor ...
– shading technique that interpolates normal vectors rather than intensities *
Gamma correction Gamma correction or gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in video or still image systems. Gamma correction is, in the simplest cases, defined by the following power-law expression: : V_\text ...
* Bidirectional reflectance distribution function – generalized reflection models *
Specular highlight A specular highlight is the bright spot of light that appears on shiny objects when illuminated (for example, see image on right). Specular highlights are important in 3D computer graphics, as they provide a strong visual cue for the shape of a ...
– other specular lighting equations


External links


Phong reflection model in Matlab

Phong reflection model in GLSL


References

{{DEFAULTSORT:Phong Reflection Model Computer graphics algorithms Shading Vietnamese inventions