Game Development Reference
In-Depth Information
N is the unit surface normal
L is the unit vector in the
direction of the light source.
V is the unit vector in the
direction of the viewer.
R is the unit vector in the
direction of reflection from
the simulated light source.
H is the unit angul r bisector
N
H
L
R
V
B
a
of V and L (the halfway
vector).
T is a unit vector in the plane
of the surface that is
perpendicular to N (the
tangent).
B is unit vector in the plane
of the surface that is
perpendicular to both N and
T (the binormal).
T
Angle between R and V less than 90
V
R
P
Angle between V and R greater than 90
The Blinn-Phong shading model (also called the Blinn-Phong reflection model or the
modified Phong reflection model) is a modification to the Phong reflection model.
In the Blinn model, the model is required to compute the half vector. The half-angle
vector ( H ) is the direction halfway between the view direction and the light position.
The Blinn model compares the half-angle vector to the surface normal. It then raises
this value to a power representing the shininess of the surface:
H = (L + V)/ǀL + Vǀ
Blinn term= (H.N) s
Here, s is the shininess of the surface.
The code for the Blinn-Phong model is as follows:
vec3 halfDir = normalize(lightDir + viewDir);
float specAngle = max(dot(halfDir, normal), 0.0);
specular = pow(specAngle, 16.0);
vFinalColor = vec4(ambientColor + lambertian * diffuseColor +
specular * specColor, 1.0);
The preceding code describes the way a surface reflects light as a combination of the
diffuse reflection of rough surfaces with the specular reflection of shiny surfaces.
 
Search WWH ::




Custom Search