Lighting II: specular reflection, generalized lighting models
CS 248 - Introduction to Computer Graphics
Autumn Quarter, 2004
Lecture notes for Tuesday, November 30 (finished on Thursday, December 2)
Table of contents:
- Reflection (continued)
- Generalizing the reflection model
Press here for the Powerpoint slides about
To save time, I did not cover the issue of local versus infinite L and
V in class. I'm leaving it in the notes in case you're interested.
Infinite L, i.e. infinitely distant lighting, is invoked in OpenGL by
setting the homogeneous coordinate W = 0.0 when specifying the position of the
light source in (for example) glLightFv(x,y,z,W). Infinite V,
i.e. infinitely distant viewing, is invoked in OpenGL by setting
GL_LIGHT_MODEL_LOCAL_VIEWER = GL_FALSE in glLightModeli(). Note that moving
the viewer to infinity in this way is only for the purpose of lighting,
not viewing, i.e. it changes the intensities computed for surfaces, but it
does not change the geometry of the image you see.
If vertex normals are passed into the rendering pipeline along with vertex
coordinates, and they can be assumed to be pre-normalized, then the rendering
pipeline doesn't need to perform any square roots at all.
OpenGL natively supports only Gouraud (i.e. intensity) interpolation. Phong
(i.e. normal vector) interpolation is not supported natively, but it can be
implemented (during rasterization) using the flexible shading architecture
available in most modern hardware accelerators. Angle interpolation would be
harder to implement. However, assuming modest changes in normal vector
direction from vertex to vertex, the visual difference between normal and angle
interpolation is small.
Copyright © 2004 Marc Levoy
December 2, 2004 08:29:43 PM