Home      Discussion      Topics      Dictionary      Almanac
Signup       Login
Phong reflection model

Phong reflection model

Discussion
Ask a question about 'Phong reflection model'
Start a new discussion about 'Phong reflection model'
Answer questions from other users
Full Discussion Forum
 
Encyclopedia
The Phong reflection model (also called Phong illumination or Phong lighting) is an empirical model
Empirical modelling
Empirical modelling refers to any kind of modelling based on empirical observations rather than on mathematically describable relationships of the system modelled.-EM:...

 of the local illumination of points on a surface
Surface
In mathematics, specifically in topology, a surface is a two-dimensional topological manifold. The most familiar examples are those that arise as the boundaries of solid objects in ordinary three-dimensional Euclidean space R3 — for example, the surface of a ball...

. In 3D computer graphics
3D computer graphics
3D computer graphics are graphics that use a three-dimensional representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images...

, it is sometimes ambiguously referred to as Phong shading
Phong shading
Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across rasterized polygons and computes pixel colors based on the interpolated...

, in particular if the model is used in combination 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
Shading refers to depicting depth perception in 3D models or illustrations by varying levels of darkness.-Drawing:Shading is a process used in drawing for depicting levels of darkness on paper by applying media more densely or with a darker shade for darker areas, and less densely or with a lighter...

”.

History


The Phong reflection model was developed by Bui Tuong Phong
Bui Tuong Phong
Bui Tuong Phong was a Vietnamese-born computer graphics researcher and pioneer. His publications are most often referred to using his family name, Bùi, which comes before his given name by Vietnamese name convention, but his inventions are remembered under his given name Phong, since it is...

 at the University of Utah
University of Utah
The University of Utah, also known as the U or the U of U, is a public, coeducational research university in Salt Lake City, Utah, United States. The university was established in 1850 as the University of Deseret by the General Assembly of the provisional State of Deseret, making it Utah's oldest...

, who published it in his 1973 Ph.D. dissertation. It was published in conjunction with a method for interpolating the calculation for each individual pixel
Pixel
In digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....

 that is rasterized from a polygonal surface model; the interpolation technique is known as Phong shading
Phong shading
Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across rasterized polygons and computes pixel colors based on the interpolated...

, 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 evolved into a 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
Diffuse reflection is the reflection of light from a surface such that an incident ray is reflected at many angles rather than at just one angle as in the case of specular reflection...

 of rough surfaces with the specular reflection
Specular reflection
Specular reflection is the mirror-like reflection of light from a surface, in which light from a single incoming direction is reflected into a single outgoing direction...

 of shiny surfaces. It is based on Bui Tuong Phong
Bui Tuong Phong
Bui Tuong Phong was a Vietnamese-born computer graphics researcher and pioneer. His publications are most often referred to using his family name, Bùi, which comes before his given name by Vietnamese name convention, but his inventions are remembered under his given name Phong, since it is...

's informal observation that shiny surfaces have small intense specular highlight
Specular highlight
A specular highlight is the bright spot of light that appears on shiny objects when illuminated . Specular highlights are important in 3D computer graphics, as they provide a strong visual cue for the shape of an object and its location with respect to light sources in the scene.-Microfacets:The...

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 and are defined as the intensities (often as RGB values) of the specular and diffuse components of the light sources respectively. A single term 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:
: specular reflection constant, the ratio of reflection of the specular term of incoming light: diffuse reflection constant, the ratio of reflection of the diffuse term of incoming light (Lambertian reflectance
Lambertian reflectance
If a surface exhibits Lambertian reflectance, light falling on it is scattered such that the apparent brightness of the surface to an observer is the same regardless of the observer's angle of view. More technically, the surface luminance is isotropic...

): ambient reflection constant, the ratio of reflection of the ambient term present in all points in the scene rendered: 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, is defined as the set of all light sources, as the direction vector from the point on the surface toward each light source ( specifies the light source), as the normal
Surface normal
A surface normal, or simply normal, to a flat surface is a vector that is perpendicular to that surface. A normal to a non-flat surface at a point P on the surface is a vector perpendicular to the tangent plane to that surface at P. The word "normal" is also used as an adjective: a line normal to a...

 at this point on the surface, as the direction that a perfectly reflected ray of light would take from this point on the surface, and as 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 :

where the direction vector is calculated as the reflection of on the surface characterized by the surface normal using:


and the hats indicate that the vectors are normalized. The diffuse term is not affected by the viewer direction (). The specular term is large only when the viewer direction () is aligned with the reflection direction . Their alignment is measured by the power of the cosine of the angle between them. The cosine of the angle between the normalized vectors and is equal to their dot product
Dot product
In mathematics, the dot product or scalar product is an algebraic operation that takes two equal-length sequences of numbers and returns a single number obtained by multiplying corresponding entries and then summing those products...

. When 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
Computer graphics are graphics created using computers and, more generally, the representation and manipulation of image data by a computer with help from specialized software and hardware....

, this equation is typically modeled separately for R, G and B intensities, allowing different reflections constants and for the different color channels
Channel (digital image)
Color digital images are made of pixels, and pixels are made of combinations of primary colors. A channel in this context is the grayscale image of the same size as a color image, made of just one of these primary colors. For instance, an image from a standard digital camera will have a red, green...

.

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 also addresses the computation of the specular term since the calculation of the power term may be computationally expensive. Considering that the specular term should be taken into account only if its dot product is positive, it can be approximated by realizing that


for , for a sufficiently large, fixed integer (typically 4 will be enough), where is a real number (not necessarily an integer). The value can be further approximated as ; this squared distance between the vectors and is much less sensitive to normalization errors in those vectors than is Phong's dot-product-based .

The value can be chosen to be a fixed power of 2, where is a small integer; then the expression can be efficiently calculated by squaring times. Here the shininess parameter is , proportional to the original parameter .

This method substitutes a few multiplications for a variable exponentiation.

Inverse Phong reflection model


The Phong reflection model in combination with Phong shading
Phong shading
Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across rasterized polygons and computes pixel colors based on the interpolated...

 is an approximation of shading of objects in real life. This means that the Phong equation can relate the shading seen in a photograph
Photograph
A photograph is an image created by light falling on a light-sensitive surface, usually photographic film or an electronic imager such as a CCD or a CMOS chip. Most photographs are created using a camera, which uses a lens to focus the scene's visible wavelengths of light into a reproduction of...

 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
Albedo , or reflection coefficient, is the diffuse reflectivity or reflecting power of a surface. It is defined as the ratio of reflected radiation from the surface to incident radiation upon it...

) which may vary within the object. Thus the normals of an object in a photograph can only be determined, by introducing additive information such as the number of lights, light directions and reflection parameters.

For example we have a cylindrical object for instance a finger and like to calculate the normal 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:


With a constant equal to the ambient light and a constant equal to the diffusion reflection. We can re-write the equation to:


Which can be rewritten for a line through the cylindrical object as:


For instance if the light direction is 45 degrees above the object we get two equations with two unknowns.


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 . 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 those geometric constraints can be obtained using principal component analysis (PCA) on a database of depth-maps of faces, allowing only surface normals solutions which are found in a normal population.

Applications


As already implied, the Phong reflection model is often used together with Phong shading
Phong shading
Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across rasterized polygons and computes pixel colors based on the interpolated...

 to shade surfaces in 3D computer graphics
3D computer graphics
3D computer graphics are graphics that use a three-dimensional representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images...

 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
Thermal radiation is electromagnetic radiation generated by the thermal motion of charged particles in matter. All matter with a temperature greater than absolute zero emits thermal radiation....

 from the Pioneer probes
Pioneer program
The Pioneer program is a series of United States unmanned space missions that was designed for planetary exploration. There were a number of such missions in the program, but the most notable were Pioneer 10 and Pioneer 11, which explored the outer planets and left the solar system...

 in an attempt to explain the Pioneer anomaly
Pioneer anomaly
The Pioneer anomaly or Pioneer effect is the observed deviation from predicted accelerations of the Pioneer 10 and Pioneer 11 spacecraft after they passed about on their trajectories out of the Solar System....

.

See also


  • List of common shading algorithms
  • Bidirectional reflectance distribution function
    Bidirectional reflectance distribution function
    The bidirectional reflectance distribution function is a four-dimensional function that defines how light is reflected at an opaque surface...

     – another reflection model
  • Blinn–Phong shading model
    Blinn–Phong shading model
    The Blinn–Phong shading model is a modification to the Phong reflection model developed by Jim Blinn....

     – alteration of the Phong reflection model to trade precision with computing efficiency
  • Phong shading
    Phong shading
    Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across rasterized polygons and computes pixel colors based on the interpolated...

     – shading technique that interpolates normal vectors rather than intensities
  • Specular highlight
    Specular highlight
    A specular highlight is the bright spot of light that appears on shiny objects when illuminated . Specular highlights are important in 3D computer graphics, as they provide a strong visual cue for the shape of an object and its location with respect to light sources in the scene.-Microfacets:The...

    – other specular lighting equations