Homework 8: Illumination and Shading

For this assignment we implemented an illumination model for our graphics environment. We began by writing a funciton to calculate the Lambertian reflection. Then, we wrote a function to calculate the Phong specular reflection. Finally, we wrote a function which, given a linked list of light sources, the normal, the view vector, the location, the specular reflection, and some information about the ambient light, will calculate the apparent color of the specified pixel.

Required Images


This is the first required image with one point light source at (-5, 0, 0).

This is the second required imgae with two light sources--the one from before, as well as a blue light source at (5, 1, 0)--down and to the right.

Questions

  1. If you use different specular coefficients for the Phong specularity model, what is the apparent effect of increasing or decreasing the coefficient? Test this out, don't just make up an answer.

    nS = 40

    nS = 80

    kS = 120
    As can be seen from the images above, increasing the specularity coefficient makes the object shinier (smoother) (as one would expect).
  2. If you integrated the light sources with your modeling system, how did you do it?
    Our light sources are somewhat integrated with our 3D modeling system. They exist as a global linked list, and any program can add a light to the list at any time by calling InsertLight(). We plan to have Set3DTransform move the points and adjust direction as appropriat for the light sources. Also, polyFill will eventually take into account light sources when coloring its polygons.
  3. If you implemented any other extensions, explain what you did and how you did it.
    In addition to partially integrating our light sources with our 3D modeling system, we also implemented directional lighting. Basically, the user declares a light with a direction rather than a location, and the L vector is held constant for the color calculation across all the pixels.

    Directional light source pointed towards positive x and negative z.

    Same as before, but with a point light source as well, coming from the lower left.