Section 3.9: Consider a particular light source as being a vector with (R,G,B) components named (Ir, Ig, Ib). We will often speak of an intensity I when we actually mean a vector of primaries.
First: The goal of this game is to calculate, at any point on a surface, the correct (R,G,B) value to display. Later we will discuss shading models such as uniform shading (making the whole polygon one color); Gouraud shading (a way of economically computing a variable shading across a polygon) and Phong shading (the de luxe method.)
Please note that formula 3.99 is an empirical formula - that is, one that was developed as a "rule of thumb" because it makes reasonably good-looking pictures. It is not based on fundamental physical principles. For instance, it does not take account of the distance to the light source.
Point and Spot Lights
Query 7.1. A rectangle is centered at the origin, with its surface normal = (1,1,0). The sun is directly overhead. Compute Ii, the surface intensity factor, assuming that Ip (the intensity of the sun) is 1.0.
Query 7.2. Consider Figure 3.35. A spotlight produces a cone of light, and the desired effect is an elliptical or circular bright region on the illuminated surface. Let the spotlight source be located at a point L; the center of the beam's focus on the panel (polygon) is at point C, and we are trying to compute the illumination at point P. The light's cone has an angle of theta.
We want a method which uses some kind of an IF statement, together with the positions of P, C and L, to determine how much light the surface produces.
Condition 1 (the easy version): You may assume that the line C-L is perpendicular to the surface.
Condition 2 (the semi-tough one): You may not assume that C-L is perpendicular to the surface.
Condition 3 (for serious graphics folks.) What if you don't want your spot to have a hard edge? Can you think up a way to define a region of smoothly diminishing light, between the hard-lit zone and the unlit zone?
Ambient Light is a term that we add into the illumination to represent "non-directional" light. Actually it allows for light that has bounced many times.
Shadows and Transparency: Skip 'em.
Diffuse Reflection is "matte surface" reflection. It obeys the cosine law described back in section 3.9.1.
Specular Reflection has a more complex law. The intention is to only put lots of specular light into the image (for a particular surface point P) if the view angle is close to the reflected vector angle (see figure 3.38.) "Close to" is measured by (cos phi)**g - that is to say, you take the cosine of the angle by which you "miss" the direct reflection ray R, and square it or cube it or (ninth it.) Since cosine is always less than or equal to 1, raising it to higher powers makes for a RAPID drop-off as the angle varies from zero.
How do you compute phi? It's harder than computing theta (which is simply based on a dot product between the normal and the illumination vector.) If you knew the vector R (again, from figure 3.38) you could dot it with V and get COS phi (which is what we want of course.)
It turns out by means magical and mysterious, that R=2N(N.L)-L, when everybody is a unit vector. So all you have to do is calculate N.L, multiply it by 2, multiply N by this magnitude, and subtract L.
Query 7.3. A point light source is at (-10,10,0). A shiny piece of ceramic tile is laying on the X,Z plane at the origin. Your eye is at (10,9,0) looking at the origin. The specular exponent g for this tile is 10; the light's intensity Ii = (1.0, 1.0, 1.0) that is, white light; the ceramic's specular coefficient Ks is (1.0, 0.0, 0.2). Ignoring diffuse and ambient light, compute the RGB of the light reaching your eye from the point at (0,0,0) on the tile.
Gouraud Shading. Compute illumination values at the three corners of a triangle (the normals will be the AVERAGES of the normals of the polygons that meet at that corner.) Figure 3.39 is misleading because it shows just one polygon but usually there are many; see Figure 3.41.
Phong Shading computes "averaged" normals for EACH PIXEL on the surface of the polygon. Lots more arithmetic! It then computes the illumination based on all these thousands of normals. Think of a porcupine.
Radiosity: Divide the whole world up into n (hundreds or thousands of) patches. Set up n linear equations which relate the light coming off any patch, to the light coming into it from all the other patches. Solve this set of equations. Big job, huh? Handles diffuse light correctly, which does away with the need for the "ambient approximation." Does not handle specular light.
Progressive refinement means doing a crude first guess of radiosity, then "flowing" light energy through the equations.
Painter's Algorithm and Z-buffer. Previously discussed in class. Object and image space operations, respectively.
Texture Mapping. Neat technique! The texture image is parametrized in (u,v) space. Hardware or software has to transform this image onto a polygon (or curved surface) in 3d space, thence onto the 2d screen. Of course we don't ever make 2 operations in graphics when we can combine them into one, and so in fact we develop algorithms to go directly from texture space to screen space. There are actually a lot of ways to mess up this process, however, because of sampling problems and perspective projection problems.
Bump Maps. Producing a strawberry by putting a texture map onto it is troublesome; but you can get the same effect by writing a procedure to bend the surface normal vector in a systematic fashion. This causes the lighting model to act as though there are bumps (or dips) in the surface.
Environment Maps are, in effect, cylindrical texture maps (centered on the view volume) that are used to provide color information that comes in on the "specular sight line". Thus when you want to know what to show on a shiny surface, you compute the reflected look-ray, then see where it hits the environment map. In this way you can make a sleek automobile, for instance, have a bluish tint on the upper half (reflecting "sky") and a greenish tint below, reflecting the "grass" it's sitting on.
END of Chapter 3, at last!
Back to the course index
Back to the course syllabus
Back to the previous lecture
Onward to the next lecture