当先锋百科网

首页 1 2 3 4 5 6 7

Phong and Blinn-Phong Reflection Model

2023-6-20 21:46:42

The Phong reflection model was proposed by Bui Tuong Phong in 1975, which was used to simulate the reflection attenuation phenomenon on the object’s surface. Well the Blinn-Phong model was a modified version of Phong model by Jim Blinn. In this note, I will firstly introduce the theory of Phong model, and then the Blinn-Phong model, together with its improvement.

Phong Reflection Model

In Phong model, there are several material parameters:

i s i_s is which is the specular intensity;

i d i_d id which is the diffuse intensity;

i a i_a ia which is the ambient intensity;

k s k_s ks which is the specular reflection constant, the ratio of specular reflection of incoming light;

k d k_d kd which is the diffuse reflection constant, the ratio of diffuse reflection of incoming light;

k a k_a ka which is the ambient reflection constant, the ratio of reflection of ambient of all the points in the rendered scene;

α \alpha α is the roughness constant.

In the scene, we have those vectors in the figure:

在这里插入图片描述

in which,

L m ^ \hat{L_m} Lm^ is the direction vector from the point on the surface to the light source;

N ^ \hat{N} N^ is the surface normal;

R m ^ \hat{R_m} Rm^ is the specular reflection vector;

V ^ \hat{V} V^ is the viewer direction vector.

The subscript m m m presents the m t h m_{th} mth light source. Therefore, for each of light sources, the illumination of each point on the surface I P I_P IP can be calculated from:
I P = k a i a + ∑ m ∈ l i g h t s ( k d ( L m ^ ⋅ N ^ ) i m , d + k s ( R m ^ ⋅ V ^ ) α i m , s ) \begin {align*} & I_P = k_ai_a + \sum_{m\in lights}(k_d(\hat{L_m} \cdot \hat{N})i_{m,d}+k_s(\hat{R_m} \cdot \hat{V})^\alpha i_{m,s}) \end {align*} IP=kaia+mlights(kd(Lm^N^)im,d+ks(Rm^V^)αim,s)
The specular highlight of each point on the surface is actually decided by the viewing direction and specular reflection direction. The specular direction vector R m ^ \hat{R_m} Rm^ is calculated as the reflection of L m ^ \hat{L_m} Lm^ on the surface characterized by the surface normal N ^ \hat{N} N^ :

在这里插入图片描述

R m ^ = 2 ( L m ^ ⋅ N ^ ) N ^ − L m ^ \begin {align*} & \hat{R_m} = 2(\hat{L_m} \cdot \hat{N})\hat{N}-\hat{L_m} \end {align*} Rm^=2(Lm^N^)N^Lm^

Blinn-Phong Reflection Model

Remind that in the Phong reflection model, the specular the surface will disappear when the angle between R m ^ \hat{R_m} Rm^ and V ^ \hat{V} V^ is larger than 9 0 ∘ 90^\circ 90 since the dot product of them is negative, which is usually set as zero.

在这里插入图片描述

which results in the effect of cutoff of specular edge of light reflection, as shown in the figure.

在这里插入图片描述

Therefore, a new vector named halfway was introduced to eliminate the negative dot product. The halfway vector is defined as:

在这里插入图片描述

H m ^ = L m ^ + V ^ ∥ L m ^ + V ^ ∥ \begin {align*} & \hat{H_m} = \frac{\hat{L_m}+\hat{V}}{\left \| \hat{L_m}+\hat{V} \right \| } \end {align*} Hm^= Lm^+V^ Lm^+V^
Now just replace the specular term of Phong model:
I B P = k a i a + ∑ m ∈ l i g h t s ( k d ( L m ^ ⋅ N ^ ) i m , d + k s ( N ^ ⋅ H m ^ ) α ′ i m , s ) \begin {align*} & I_{BP} = k_ai_a + \sum_{m\in lights}(k_d(\hat{L_m} \cdot \hat{N})i_{m,d}+k_s(\hat{N} \cdot \hat{H_m})^{\alpha'} i_{m,s}) \end {align*} IBP=kaia+mlights(kd(Lm^N^)im,d+ks(N^Hm^)αim,s)
Because the halfway vector and the surface normal is likely to be smaller than the angle between R m ^ \hat{R_m} Rm^ and V ^ \hat{V} V^ used in Phong’s model (unless the surface is viewed from a very steep angle for which it is likely to be larger), the exponent α ′ \alpha' α can be set α ′ > α \alpha' > \alpha α>α to close the Phong model. The rendering result of Blinn-Phong can be seen in the figure:

在这里插入图片描述

Reference

Phong Reflection Model

Blinn-Phong Reflection Model

OpenGL Tutorial 23 - Blinn-Phong Lighting)