CS3500 Computer Graphics Spring 2009. P J Narayanan Programming Assignment 4 Due: Midnight. April 26, 2009 Objective: To place three-dimensional objects in the world and study their interaction with material properties, lighting, normals, etc. Create a world with a gray background and a few objects in it. Choose your geometric objects from cubes, spheres, cylinders, etc. Include at least 4 objects of varying sizes. Set the camera at origin. Set the objects such that they are visible. The combined-centroid C of the objects is the point at which the view is focussed. Give different objects different material properties: emissive, ambient, diffuse colours and shininess. Define 2 light sources. L1 is a directional light source located behind the camera and facing in the camera's direction. L2 is a spotlight whose location can be controlled from the keyboard. Draw the location of L2 using a white point of size 4-5 pixels to be visible. Have a mode in which all your objects rotate about their centroid at some velocity (time-based velocity is not necessary). The following are the keyboard controls: Key Action --- ------ 1 L1 on/off (toggle) 2 L2 on/ooff (toggle) l Move L2 closer to pt C by delta L Move L2 away from C by delta y Move L2 up by delta (in +Y direction) Y Move L2 down by delta r Rotate L2 about pt C in a horizontal plane by +10 degrees R Rotate L2 about pt C in a horizontal plane by -10 degrees c Change the colour of L2 randomly. (Choose random unsigned byte r-g-b values!) S Increase shininess of objects by 10 subject to max s Decrease shininess of objects by 10 subject to min i Toggle between flat/smooth shading w Start/stop rotation of all objects (not lights) about a vertical axis through C at a const angular velocity Geometric objects are available in the glu toolkit and glut toolkit. (Try man pages of gluSphere, glutSolidCone, etc. More pointers are at the end of those man pages.) Try out different number of triangles for each and play with the various factors above to understand the lighting effects well. You may go beyond the minimum requirements given above.