CS184 Lecture 28 summary

Light Sources

The simplest kind of light source is a point source. It emits light in rays that emanate from a single point. We will talk a lot about the intensity of the light. This is a measure of how much power (energy per unit time) is coming from the source. But we wont be specific about how this power is measured. Normally, it would be measured as radiated power per unit area. But sometimes its more convenient to measure it as power per unit solid angle, so that it does not decrease with distance.

Note that real light intensity from a point source decreases with distance at a rate of 1/r2. That's because the area that a given flux of rays hits varies as r2 as the rays travel. The intensity is power/area so as the area increases, the intensity decreases.

Another kind of light source is an area source. Instead of emanating from a single point, the light emanates from many points in an area. A good example of an area source is a spot light, or a TV screen.

You may also hear about distributed light sources, which emit from a volume. A fluorescent light is well-modeled as a distributed light source close up.

Sources may or may not be directional. That is, the intensity of light emitted may or may not depend on the direction in which it travels.

Superposition

The most important principle to keep in mind when thinking about light and shading is the principle of superposition. In its simplest version, it states that when there are two or more light sources, the total light intensity measured at any point in the environment is the sum of the intensities measured with just one of the sources on at a time.

The number of lights need not be finite to apply superposition. e.g. you can model an area or distributed source as a sum of point sources. Note that the sum turns into an integral in this case, but the method still works.

Surface Shading

In simple rendering systems like VRML and OpenGL, surfaces come in 3 varieties:

Ambient Diffuse Reflection

The simplest lighting model is a uniform field of light in all directions, which is called ambient light. We measure the intensity of ambient light with the symbol Ia. The amount of ambient light that reflects off a surface is determined by the surfaces ambient-diffuse reflection coefficient, kd. This amount is given by:

Iambdiff = kd Ia

The value of kd lies between 0 and 1. A value near 0 is a very dark surface. A value near 1 is a very bright surface.

Note: Although the value kd is a scalar, all the lighting equations can be repeated once each for R, G and B channels. There are normally 3 values used for kd to take this into account.

Directional Diffuse Reflection - Lambertian Surfaces

Most surfaces scatter light uniformly in all directions, no matter what the direction of the source is. Such surfaces are called Lambertian. That does not mean their reflected light is independent of the source direction however. The intensity (power/area) of the light hitting a surface from a source depends on the angle between the source and the normal to the surface. The more normal the source is to the surface, the brighter the surface appears.

If N is a unit normal to the surface, and L is a unit direction to the light source q, then the diffuse intensity due to the source is

Iq,diff = kd Iq (N . L) = kd Iq cos q

where cos q is the angle between N and L.

Specular Reflection - Phong Model

Many surfaces exhibit a specular (shiny) reflection or highlight. A perfect reflector reflects light along a direction R which is at the same angle to N that L is, where L is the direction to the light source. Another way to characterize R is that it is the vector pointing away from the surface such that R+L is parallel to N. Let V be the viewing direction, then the specular reflection due to a light source q is given by:

Iq,spec =  W(q) Iq cos f ns

where q is the angle from L to N, and f is the angle from V to R. The quantity ns is called the Phong exponent and is used to control the sharpness of the highlight. A large value (>10) will lead to quite a shiny surface. A small value will lead to a dull-looking surface.

The function W(q) replaces the constant kd in the diffuse formulae. While W(q) is roughly constant over a large range of q values, it deviates at large q, especially as q approaches 90o. See the textbook for graphs of typical W(q) values.

Specular Reflection - Halfway Vector

A slight variation on the Phong model is the so-called halfway vector method. Instead of measuring angles between N, L, V and R, we define a vector H as

H = (L + V)/|L + V|

Now this vector is exactly equal to N if the vector V is parallel to the reflection direction R. When it deviates from N, the angle of deviation is easily shown to be f/2. Therefore the inner product (N . H) is cos (f/2). The halfway vector specular formula is:

Iq,spec =  ks Iq (N . H) ns

For simplicity, we replace W(q) with a single constant ks. The halfway vector approach avoids explicit computation of R, and is simple to implement. It is used on many simple renderers, and is the specular equation for VRML.