CS 381  >  Week 10 Review Problems

CS 381, Fall 2003
Week 10 Review Problems

Below are some problems related to the material covered in class recently. Answers are in the Answers section, below. Do not turn these in.

You can expect the Final Exam (on Wednesday, December 17) to contain problems similar to some of these.

Problems

  1. Where in the OpenGL geometry pipeline do most of the lighting computations go? Be as specific as possible.
     
  2. a. What are the three main ways in which the direction of a beam of light can be altered by interaction with an object? b. Which of these three was covered most in this class?
     
  3. We could have modelled lighting much more realistically than we did by using ray tracing. But we did not. List some reasons why not.
     
  4. a. What does “specular” mean? b. How does light reflect off a specular surface?
     
  5. a. In the context of light reflection, what does “diffuse” mean? b. How does light reflect off a perfectly diffuse surface? c. What is another name for a perfectly diffuse surface?
     
  6. a. What is “ambient” light? b. In CG lighting, what highly unrealistic assumption do we usually make about ambient light?
     
  7. a. In the context of lighting, what is “attenuation”?
     
  8. What is the shape of a typical light source in CG?
     
  9. How is the Lambert cosine usually computed?
     
  10. The Phong Model splits light into three types. a. Name and briefly explain each one. b. OpenGL adds a (very simple) fourth type. What is it?
     
    1. Suppose that the ambient light in a scene has color (0.4, 0.4, 0.4) and that the paint color of a vertex is (1.0, 0.5, 0.0). Compute the ambient component of the Phong model.
    2. Suppose that the direct light in this same scene has color (1.0, 1.0, 1.0) and, for the vertex from part a, the Lambert cosine is 0.8. Compute the diffuse component of the Phong model.
    3. Suppose that specular lighting has been disabled. Compute the final Phong-Model color for the vertex in parts a & b.

     
  11. a. Explain how the specular component of the Phong Model is computed. b. By default, OpenGL deviates slightly from the standard Phong-Model specular computations. Explain. c. Can OpenGL be forced to do the standard Phong-Model specular computation? If so, how?
     
  12. a. What is a “facet normal”? b. How is a facet normal computed? c. Facet normals are easy to compute. Despite this, we do not use facet normals much. Why not?
     
  13. a. How are normal vectors computed in Gouraud shading? b. What is another way to compute normal vectors?
     
  14. OpenGL follows Gouraud shading in that lighting computations are only done at vertices. a. Why is this? (We could do lighting in the fragment operations, right?) b. If lighting is only computed at vertices, how is the color of polygon interiors determined when a surface is lit?
     
  15. Some light sources are “at infinity”. List some ways in which this affects the OpenGL lighting computations.
     
  16. Where a light source actually lies in a scene may not be the same as the position specified with “glLightfv(..., GL_POSITION, ...)” How is the actual position determined?
     

Answers

  1. Most lighting computations occur in the “vertex operations” phase of the pipeline, just after model/view and just before projection.
    1. Reflection, refraction, diffraction.
    2. In this class, we dealt almost entirely with reflection.
  2. We did not cover ray tracing for the following reasons.
    1. Specular means mirror-like.
    2. Light reflects off a specular surface so that the angle of incidence equals the angle of reflection. That is, the angle between the surface and the entering beam of light is equal to the angle between the surface and the exiting beam of light.
    1. In the context of light reflection, diffuse means reflecting in all directions.
    2. Light reflects off a perfectly diffuse surface equally in all directions. Thus, if the surface can be seen, then its brightness does not depend on the point from which it is viewed.
    3. Perfectly diffuse surfaces are said to be Lambertian.
    1. Ambient light is light that bounces around a room (as opposed to light that comes directly from a light source).
    2. When we model ambient light, we generally make the unrealistic assumption that it has the same brightness and color in every place and from every direction.
  3. Attenuation refers to the fact that light drops off in intensity as distance from the light source increases.
  4. In CG, a typical light source consists of a single point.
  5. The Lambert cosine is usually computed by finding the dot product of the surface normal vector with the light direction vector. If these are both unit vectors, then the result is the Lambert cosine.
    1. The Phong Model splits light into:
      • Ambient: Light bouncing around the scene, reflected in a perfectly diffuse manner.
      • Diffuse: Light coming directly from a light source, reflected in a perfectly diffuse manner.
      • Specular: Light coming directly from a light source, reflected in a specular manner.
    2. To these three, OpenGL adds emitted light: light emitted by the surface being drawn.
    1. We find the ambient color by multiplying the two given colors component by component:
      R = 0.4 × 1.0. = 0.4.
      G = 0.4 × 0.5. = 0.2.
      B = 0.4 × 0.0. = 0.0.
      Result: The ambient component of the Phong Model is (0.4, 0.2, 0.0).
    2. We find the diffuse color by multiplying the Lambert cosine by the two given colors component by component:
      R = 0.8 × 1.0 × 1.0. = 0.8.
      G = 0.8 × 1.0 × 0.5. = 0.4.
      B = 0.8 × 1.0 × 0.0. = 0.0.
      Result: The diffuse component of the Phong Model is (0.8, 0.4, 0.0).
    3. To determine the final Phong-Model color, we first add the colors found above, component by component:
      R = 0.4 + 0.8 = 1.2.
      G = 0.2 + 0.4 = 0.6.
      B = 0.0 + 0.0 = 0.0.
      We obtain (1.2, 0.6, 0.0). We complete our computation by clamping all values greater than 1.0 to 1.0. Result: The final Phong-Model color is (1.0, 0.6, 0.0).
    1. The specular component of the Phong model is computed by first multiplying the direct lighting color by the specular color of the surface, component by component. Then the light direction vector is reflected, using the surface normal, resulting in the reflected light direction. The cosine of the angle between the reflected-light direction and the viewing direction is raised to a power (the shininess) and this number is multiplied by the color found above.
    2. By default, OpenGL does not use the actual viewing direction in the specular lighting compuations. Instead, it uses (0, 0, 1).
    3. Yes, OpenGL uses the actual viewing direction in its specular lighting computations if local viewer mode is enabled, using:
      glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
    1. A facet normal is the normal vector for a polygon (facet). Using facet normals in CG means that every vertex in a polygon is assigned the same normal vector.
    2. We compute a facet normal by finding the cross product of two different vectors parallel to the plane of a polygon. Then we normalize this. For example, given vertices P0, P1, P2 in a polygon, we can compute a facet normal by finding
      (P1 – P0) × (P2 – P0)
      and normalizing.
    3. Using facet normals for lighting computations results in a gem-like appearance. Since we want most of our surfaces to look smooth, we usually compute normal vectors in other ways.
    1. In Gouraud shading, the normal vector at a vertex is computed by averaging the normals of the facets the vertex is incident to, and then normalizing.
    2. Normals can also be computed by:
      • Simply using facet normals.
      • Describing a surface with a mathematical formula, and using normals derived form this formula.
    1. OpenGL only does lighting computations at vertices for the sake of efficiency. If lighting were computed for each fragment, then there would usually be many more lighting computations to do, which would slow down the pipeline.
    2. When lighting is done, colors in polygon interiors are determined the same way that such colors are determined when lighting is off: by interpolating the vertex colors.
  6. For a light at infinity,
  7. The actual light position is determined by multiplying the model/view matrix by the position given in this glLight* command. The matrix used is the current model/view matrix at the time this command is executed.


CS 381, Fall 2003: Week 10 Review Problems / Last update: 14 Dec 2002 / Glenn G. Chappell / ffggc@uaf.edu