Next: 23.2.6 Putting It All
Up: 23.2 Lighting Equations
Previous: 23.2.4 Diffuse Term
The specular term also depends on whether light falls directly on the
vertex. If
is less than or equal to zero,
there is no specular
component at the vertex. (If it's less than zero, the light is on the wrong
side of the surface.) If there's a specular component, it depends on the
following:
- The unit normal vector at the vertex
(nx, ny, nz).
- The sum of the two unit vectors that point between (1) the vertex
and the light position and (2) the vertex and the viewpoint (assuming that
GL_LIGHT_MODEL_LOCAL_VIEWER is true; if it's not true, the vector
(0, 0, 1) is used as the second vector in the sum). This vector sum is
normalized (by dividing each component by the magnitude of the vector) to
yield
s = (sx, sy, sz).
- The specular exponent (GL_SHININESS).
- The specular color of the light (
).
- The specular property of the material (
).
Using these definitions, here's how OpenGL calculates the specular term:
However, if
,
the specular term is 0.
Next: 23.2.6 Putting It All
Up: 23.2 Lighting Equations
Previous: 23.2.4 Diffuse Term
David Blythe
1999-08-06