Visual illustration of the Phong equation: here the light is white, the ambient and diffuse colors are both blue, and the specular color is white, reflecting a small part of the light hitting the surface, but only in very narrow highlights. The intensity of the diffuse component varies with the direction of the surface, and the ambient component is uniform (independent of direction).

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 , 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 ”.
::反射模型 (也称为照明或照明) 是计算机图形学研究人员图设计的表面点的局部照明的实证模型.在3D计算机图形中,它有时被称为"遮",特别是如果该模型与同名插值方法一起使用,并在像素遮光器或其他可以称为遮光计算的地方使用.

History
::历史

The Phong reflection model was developed by  Bui Tuong Phong  at the  University of Utah , who published it in his 1975 Ph.D. dissertation. [1] [2]  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. Phong's methods have proven popular due to their generally efficient use of computation time per rendered pixel.
::反射模型是由犹他大学的Bui Tuong Phong开发的,他在1975年发表的博士论文中发表了它. [1] [2] 它与从多边形表面模型中对每个单个像素进行分离的计算插入的方法一起发表;插入技术被称为遮蔽,即使它与的反射模型不同. 的方法在引入时被认为是激进的,但后来成为许多染应用的实际基线染方法. 的方法因其一般高效地使用每染像素的计算时间而受到欢迎.

Concepts
::概念

Phong reflection is an empirical model of local illumination. 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. 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.
::反射是一种局部照明的实证模型.它描述了表面反射光的方法,即粗表面的分散反射与光亮表面的反射反射的组合.它基于的非正式观察,即光亮表面具有小的强烈光亮亮点,而淡的表面具有更慢的较大亮点.该模型还包括一个环境术语来解释整个场景中散射的少量光.

For each light source in the scene, components  i s  and  i d  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  controls the ambient lighting; it is sometimes computed as a sum of contributions from all light sources.
::对于场景中的每个光源,i s和i d组件被定义为光源的光谱和光散组件的强度 (通常是RGB值).一个单一的项 i a控制环境照明;有时被计算为所有光源的贡献的总和.

For each  material  in the scene, the following parameters are defined:
::对于场景中的每种材料,定义了以下参数:

k s , which is a specular reflection constant, the ratio of reflection of the specular term of incoming light,
k d , which is a diffuse reflection constant, the ratio of reflection of the diffuse term of incoming light ( Lambertian reflectance ),
k a , which is an ambient reflection constant, the ratio of reflection of the ambient term present in all points in the scene rendered, and
α , 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.
Vectors for calculating Phong and Blinn–Phong shading

Furthermore, there is
::另外,还有一个

lights , which is the  set  of all light sources,
L ^ m , which is the direction vector from the point on the surface toward each light source ( m  specifies the light source),
N ^ , which is the  normal  at this point on the surface,
R ^ m , which is the direction that a perfectly reflected ray of light would take from this point on the surface, and
V ^ , 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 p :
::然后,反射模型提供了一个方程来计算每个表面点I p的照明:

I p = k a i a + m lights ( k d ( L ^ m N ^ ) i m , d + k s ( R ^ m V ^ ) α i m , s ) .

where the direction vector  R ^ m  is calculated as the  reflection  of  L ^ m  on the surface characterized by the surface normal  N ^  using
::其中,方向向量R ^ m是用表面常数N ^ 进行表征的表面上L ^ m的反射计算的.

R ^ m = 2 ( L ^ m N ^ ) N ^ L ^ m

The hats indicate that the vectors are  normalized . The diffuse term is not affected by the viewer direction ( V ^ ). The specular term is large only when the viewer direction ( V ^ ) is aligned with the reflection direction  R ^ m . Their alignment is measured by the  α  power of the cosine of the angle between them. The cosine of the angle between the normalized vectors  R ^ m  and  V ^  is equal to their  dot product . 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.
::帽子表示向量是正常化的.分散的项不受观光方向 (V ^) 的影响.光镜项只有当观光方向 (V ^ ) 与反射方向R ^ m对齐时才大.它们的对齐是通过它们之间的角的等比数的α次数来测量.正常化向量R ^ m和V ^之间的角的等比数等于它们的点积.当α是大时,在几乎镜像反射的情况下,光镜亮点将很小,因为任何与反射不对齐的视点的等比数将小于一个,当升到高次数时迅速接近零.

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 , this equation is typically modeled separately for R, G and B intensities, allowing different reflection constants  k a ,   k d  and  k s  for the different  color channels .
::当颜色以RGB值表示时,这通常是计算机图形中的情况,这个方程通常是单独为R,G和B强度建模的,允许不同的反射常数k a ,k d和k s用于不同的颜色通道.

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.
::在实施反射模型时,有很多方法可以近似模型,而不是执行精确的公式,这可以加快计算速度;例如,BlinnPhong反射模型是反射模型的修改,如果观察者和光源被视为无限时,则更有效.

Another approximation [3]  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
::另一个近似[3] 解决了在光谱项中的指数计算是如下:考虑到光谱项应该只考虑它的点积是正的,它可以近似为

max ( 0 , R ^ m V ^ ) α = max ( 0 , 1 λ ) β γ = ( max ( 0 , 1 λ ) β ) γ max ( 0 , 1 β λ ) γ

where  λ = 1 R ^ m V ^ , and  β = α / γ  is a real number which doesn't have to be an integer. If  γ  is chosen to be a power of 2, i.e.  γ = 2 n  where  n  is an integer, then the expression  ( 1 β λ ) γ  can be more efficiently calculated by squaring  ( 1 β λ )   n  times, i.e.
::其中 λ = 1 − R ^ m ⋅ V ^ ,且 β = α / γ 是一个不一定是整数的实数.如果 γ 被选为 2 的次数,即 γ = 2 n,其中 n 是整数,那么表达式 (-1 − β λ ) γ 可以通过将 (-1 − β λ ) 乘以 n 次方程来更有效地计算,即

( 1 β λ ) γ = ( 1 β λ ) 2 n = ( 1 β λ ) 2 2 2 n = ( ( ( 1 β λ ) 2 ) 2 ) 2 n .

This approximation of the specular term holds for a sufficiently large integer  γ  (typically, 4 or 8 will be enough).
::对于足够大的整数 γ,这个光谱项的近似值是正确的 (通常,4 或 8 足够).

Furthermore, the value  λ  can be approximated as  λ = ( R ^ m V ^ ) ( R ^ m V ^ ) / 2 , or as  λ = ( R ^ m × V ^ ) ( R ^ m × V ^ ) / 2.  The latter is much less sensitive to normalization errors in  R ^ m  and  V ^  than Phong's dot-product-based  λ = 1 R ^ m V ^  is [ citation needed ] , and practically doesn't require  R ^ m  and  V ^  to be normalized [ citation needed ]  except for very low-resolved triangle meshes.
::此外,值λ可以近似为λ = (R ^ m − V ^ ) ⋅ (R ^ m − V ^ ) / 2,或为λ = (R ^ m × V ^ ) ⋅ (R ^ m × V ^ ) / 2.后者对R ^ m和V ^ 的规范化错误的敏感性远低于Phong的以点积为基础的λ = 1 − R ^ m ⋅ V ^ ,并且实际上不需要R ^ m 和V进行规范化[需要引用]除了非常低分辨率的三角形网格.

This method substitutes a few multiplications for a variable exponentiation, and removes the need for an accurate reciprocal-square-root-based vector normalization.
::这种方法可以替换一些乘法,并消除了基于正方根的向量规范化的需要.

Inverse model
::逆向模型

The Phong reflection model in combination with  Phong shading  is an approximation of shading of objects in real life. This means that the Phong equation can relate the shading seen in a  photograph  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 ) 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 = [ N x , N z ]  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:
::例如,我们有一个圆柱形物体,例如一个手指,并希望计算物体上一条直线上的正常N = [N x , N z].我们假设只有一个光,没有反射,并且具有统一的已知 (近似) 反射参数.然后我们可以将Phong方程简化为:

I p ( x ) = C a + C d ( L ( x ) 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:
::设 C a a 常数等于环境光,C d 常数等于扩散反射,我们可以将方程重写为:

( I p ( x ) C a ) / C d = L ( x ) 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 = [ 0.71 , 0.71 ]  we get two equations with two unknowns.
::例如,如果光方向在物体L=[0.71 ,0.71]上方45度,我们得到两个未知数的方程.

( I p C a ) / C d = 0.71 N x + 0.71 N z
1 = ( N x 2 + N z 2 )

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 = [ N x , N y , N z ] . 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. [4]
::如果物体不是圆柱形,我们有三个未知正常值N = [ N x , N y , N z ] .然后两个方程仍然允许正常在视图向量周围旋转,因此需要从先前的几何信息中获得额外的约束.例如,在面部识别中,这些几何约束可以使用面部深度图数据库上的主要组件分析 (PCA) 来获得,只允许在正常人群中发现的表面正常的解决方案. [1]

Applications
::应用

The Phong reflection model is often used together with  Phong shading  to shade surfaces in  3D computer graphics  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  from the  Pioneer probes  in an attempt to explain the  Pioneer anomaly . [5]
::反射模型经常与遮蔽一起用于3D计算机图形软件中遮蔽表面.除此之外,它也可以用于其他目的.例如,它已被用于模拟从先探测器发出的热辐射的反射,以试图解释先异常. [1]


Last modified: Wednesday, 19 March 2025, 10:37 PM