6pm - 8:20pm
DUE: Friday 6/30/06 midnight (11:59pm)
In this assignment you will experiment with lighting and material
properties of objects in the scene you created for the previous
homework. Keep at least one object with a texture, the rest need
not be texture mapped. There are no restricted gl calls in this
There are two modes in this homework. One mode refers to lighting
changes, the other refers to changing material properties. One should
be able to switch between them using a pop-up menu triggered by a
right-click of the mouse.
There should be two point light sources in the scene. A small
sphere should be displayed at the light source position if a light is
on. Only one light should initially be on. Lighting should be enabled
for all objects plus the ground plane but not the walls.
One should be able to change to position of the active light, by mouse drags.
Note that the direction of motion of a light in the world coordinates depends on the camera position and orientation: You need to infer the direction of motion from the camera position, look-at point, and the up vector.
In light mode:
Pressing key '1' (and '2') makes light one (and two) the active light.
Pressing up/down arrows increases/decreases light intensity of active light.
Pressing 's' should toggle active light on/off
Space bar turns all lights on/off
Dragging the mouse on screen moves the active light with it on the scene parallel to the screen (up/down/left/right).
Dragging with "shift" key pressed moves the light perpendicular to the
screen (in/out). ( just use vertical displacement (in y) )
I will give you tips for the light positioning interface in class. See slides.
Material Selection Interface
There are two modes within material interface. In one
mode, user can modify specular properties, in the other mode the user
can modify diffuse properties. Implement the mode selection for
material interface in any way you wish (key presses, main menu options,
submenu options, ...)
In the lower left corner of your image, display four horizontal bars, three with the gradient of a primary color (red, green or blue) from 255 to 0, and one to set shininess for specular reflection (no effect if in diffuse mode).
Space bar - cycles through objects in the scene, activating one at each press of the key.
Clicking on a point inside one of the rectangles affects the corresponding parameter of the material property of the current object. (e.g. if the current mode is material diffuse,
Clicking on the red bar changes the red component of the diffuse coefficient).
The bars can be drawn as three OpenGL rectangles, setting up a simple orthographic
camera just for this purpose (the camera should be switched back to a perspective view when the scene is drawn).
The gradient of colors is obtained by assigning suitable colors to the vertices of each polygon.
Adapted from one of Denis Zorin's assignments.