Liopoles.comSpecular reflection model in computer graphics

Phong reflection model


9.14.2018 | Ashley Lamberts

The Phong reflection model in combination with Phong shading is an approximation of shading of objects in real life. Inverse refers to the wish to estimate the surface normals given a rendered image, natural or computer-made. This means that the Phong equation can relate the shading seen in a photograph with the surface normals of the visible object.

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

Specular reflection model in computer graphics
Phong reflection model

Furthermore, the value λ can be approximated as λ = ( R ^ m − V ^ ) ⋅ ( R ^ m − V ^ ) / 2 {\displaystyle \lambda =({\hat }_ -{\hat })\cdot ({\hat }_ -{\hat })/2}, or as λ = ( R ^ m × V ^ ) ⋅ ( R ^ m × V ^ ) / 2. {\displaystyle \lambda =({\hat }_ \times {\hat })\cdot ({\hat }_ \times {\hat })/2.} The latter is much less sensitive to normalization errors in R ^ m {\displaystyle {\hat }_ } and V ^ {\displaystyle {\hat }} than Phong's dot-product-based λ = 1 − R ^ m ⋅ V ^ {\displaystyle \lambda =1-{\hat }_ \cdot {\hat }} is, and practically doesn't require R ^ m {\displaystyle {\hat }_ } and V ^ {\displaystyle {\hat }} to be normalized except for very low-resolved triangle meshes.

With C a {\displaystyle C_ } a constant equal to the ambient light and C d {\displaystyle C_ } a constant equal to the diffusion reflection. We can re-write the equation to:.

This method substitutes a few multiplications for a variable exponentiation, and removes the need for an accurate reciprocal-square-root-based vector normalization.

It is based on Phong's informal observation that shiny surfaces have small intense specular highlights, 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. It describes the way a surface reflects light as a combination of the diffuse reflection of rough surfaces with the specular reflection of shiny surfaces. Phong reflection is an empirical model of local illumination.

γ = 2 n {\displaystyle \gamma =2^ } where n is an integer, then the expression ( 1 − β λ ) γ {\displaystyle (1-\beta \lambda )^ } can be more efficiently calculated by squaring ( 1 − β λ )   n times, i.e. where λ = 1 − R ^ m ⋅ V ^ {\displaystyle \lambda =1-{\hat }_ \cdot {\hat }}, and β = α / γ is a real number which doesn't have to be an integer. If γ is chosen to be a power of 2, i.e.

This approximation of the specular term holds for a sufficiently large, integer γ (typically, 4 or 8 will be enough).

When the color is represented as RGB values, as often is the case in computer graphics, this equation is typically modeled separay for R, G and B intensities, allowing different reflections constants k a, {\displaystyle k_{\text },} k d {\displaystyle k_{\text }} and k s {\displaystyle k_{\text }} for the different color channels.

For each material in the scene, the following parameters are defined: Furthermore, we have.

As already implied, the Phong reflection model is often used together with Phong shading to shade surfaces in 3D computer graphics software. For example, it has been used to model the reflection of thermal radiation from the Pioneer probes in an attempt to explain the Pioneer anomaly. Apart from this, it may also be used for other purposes.

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.

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

The Phong reflection model (also called Phong illumination or Phong lighting ) is an empirical model of the local illumination of points on a surface. In 3D computer graphics, it is sometimes ambiguously referred to as "Phong shading", 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 ”.

We assume only one light, no specular reflection, and uniform known (approximated) reflection parameters. For example, we have a cylindrical object, for instance a finger, and wish to compute the normal N = {\displaystyle N=} on a line on the object. We can then simplify the Phong equation to:.

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.

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.

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. If the object is not cylindrical, we have three unknown normal values N = [ N x, N y, N z ] {\displaystyle N=}.

Phong's methods have proven popular due to their generally efficient use of computation time per rendered pixel. dissertation. The Phong reflection model was developed by Bui Tuong Phong at the University of Utah, who published it in his 1975 Ph.D. It was published in conjunction with a method for interpolating the calculation for each individual pixel that is rasterized from a polygonal surface model; the interpolation technique is known as Phong shading, 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.

(Additionally, the specular term should only be included if the dot product of the diffuse term is positive.). 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.

For each light source in the scene, components i s {\displaystyle i_{\text }} and i d {\displaystyle 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 a {\displaystyle i_{\text }} controls the ambient lighting; it is sometimes computed as a sum of contributions from all light sources.

The Phong reflection model contains many parameters, such as the surface diffuse reflection parameter ( albedo ) 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.

where the direction vector R ^ m {\displaystyle {\hat }_ } is calculated as the reflection of L ^ m {\displaystyle {\hat }_ } on the surface characterized by the surface normal N ^ {\displaystyle {\hat }} using.

Then the Phong reflection model provides an equation for computing the illumination of each surface point I p {\displaystyle I_{\text }} :

Their alignment is measured by the α power of the cosine of the angle between them. 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. The specular term is large only when the viewer direction ( V ^ {\displaystyle {\hat }} ) is aligned with the reflection direction R ^ m {\displaystyle {\hat }_ }. The diffuse term is not affected by the viewer direction ( V ^ {\displaystyle {\hat }} ). and the hats indicate that the vectors are normalized. The cosine of the angle between the normalized vectors R ^ m {\displaystyle {\hat }_ } and V ^ {\displaystyle {\hat }} is equal to their dot product.

Specular reflection model in computer graphics