WEEK 10: November 10 - November 18

OUTLINE:

SHADING (How does it all happen?)

  • Spotlights
    • specifying using OpenGL
    • Major Problems
    • Recursive Subdivision

LIGHTING Using OpenGL

  • Select a Lighting Model:    glLightModel    
    • select global light
    • select whether viewpoint local or infinite
    • select whether lighting should be done differently for fron and back faces
    • select whether or not to separate the specular color and apply separately
  • Enable Lighting in General:      glEnable(GL_LIGHTING)
  • Specifying Light Sources 
    • For each Light Source        glLight
      • Specify type of light:
        • directional
        • positional
          • positional spotlight

            SPOTLIGHTS WITH OPENGL

            • Must specify normalized normal for face
            • Must specify positional light with the usual attributes (position, diffuse, ambient, specular components)
            • Must specify spot cutoff angle
            • Must specify spot exponent
      • Specify attenuation (only if positional light)
      • Enable that light source:  glEnable(GL_LIGHTi)

    • Moving Light Sources (see pages 397-398 in Hill):
      • independent of the camera
      • along with the camera

  • Objects (For each Face of the Object):
    • Provide the Normal to the Face
    • Specify Materials Properties:      glMaterial
      • ambient coefficient
      • diffuse coefficient 
      • specular coefficient
      • Phong Exponent 
      • emissive color

REFERENCE(S):

Computer Graphics Using OpenGL (Hill): Chapter 8
 
OpenGL Programming Guide: Chapter ? (Lighting)  *Note:  in HTML version, it is Ch.6; in PDF format, it is Ch.5
OpenGL Manual/v.1.2:  Chapter 2 (Subdivision, Recursive Subdivision)

DEMO(S): /classes/cs3014/files/Lighting/linux_light_demo -- executable; make sure you are on a linux machine
/classes/cs3014/files/Viewing/spherical.cpp -- demonstrates interactive spherical view
/classes/cs3014/files/Lighting/2spheres_a.cpp (no light)
/classes/cs3014/files/Lighting/2spheres_b.cpp (one light)
/classes/cs3014/files/Lighting/movelight.cpp
/classes/cs3014/files/Lighting/spotdemowall.cpp
EXERCISES: CLICK FOR PRINTABLE VERSION OF EXERCISES