Lighting II: specular reflection, generalized lighting models
CS 248 - Introduction to Computer Graphics
Autumn Quarter, 2006
Lecture notes for Thursday, November 30 (finished on Tuesday, December 5)
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. OpenGL does not specify whether Gouraud interpolation
should be linear or rational linear. Modern graphics boards implement it
using rational linear interpolation.
Copyright © 2006 Marc Levoy
November 30, 2006 04:19:13 PM