Starting from:

$29.99

CS60012 Assignment 3 Solution


Description
This assignment is an extension of the lighting methods covered in the tutorials. The goal is to develop a scene with multiple light sources controllable by the user. First, display a solid teapot in the scene. Color the teapot as gray and apply some weak specular highlights. Next add three light sources around the teapot, where the sources should emit red, green, and blue lights. Each light source should be marked by small spheres of the corresponding color (i.e. red, green and blue). In addition to the three light sources, there should be soft white ambient light, and also a white light coming from the viewing direction to the teapot (let’s call it ‘viewpoint light’). At this point the static scene should look something like the following:

Next comes the animation part of the assignment. First, rotate the light sources around the teapot (you can use any path for rotation). This animation should be controllable by the user: pressing the key ‘A’ will toggle between stopping and resuming the rotation. Also, each light sources can be switched on and off by the user: keys ‘R’, ‘G’ and ‘B’ toggles between switching on and off the red, green and blue light sources respectively. When a light souce is switched off, the corresponding sphere should turn into grey (i.e. no light emission). The global ambient light and the ‘viewpoint light’ can be switched on and off with keys ‘L’ and ‘V’ respectively. Pressing the Escape key should close the display window. Finally, mouse can be used to rotate the teapot, where the light sources (i.e. the spheres) should also move accordingly along with the teapot (as shown in the demo).
Your task is to implement the scene and the animation in OpenGL using
Weightage
This assignment carries 15% of the total mark.
What to submit?
Submit the program file(s) you have implemented. You must use OpenGL with C/C++ to implement the assignment. Put all the file(s) into a zip and submit in Moodle (no files will be accepted by email). Please do not submit any unnecessary files (such as the whole project).
Copying the code is a serious academic offence, which will be treated with zero tolerance. Remind that changing variable names and white spaces do not make your code unique, it’s very easy to detect these cases using softwares.
General marking scheme
• Working program: 80%
– Displaying the teapot with R, G, B lights as colored spheres: 5%
– Ambient & viewpoint light sources: 5%
– Rotating the three light sources (R, G, B): 20%
– Controlling mouse movement to rotate the teapot & light sources :
20%
– User control to turn on/off R, G, B lights: 10%
– Turning the light source (sphere) color to grey when the source is turned off: 5%
– User control to turn on/off ambient and viewpoint light: 5%
– User control to turn on/off the animation and pressing Escape to exit: 5%
– Aesthetic part of the scene: 5%
• Documentation: 10%
– Main comment block identifying the student (name, roll number, email address): 4%
– Defining input and output parameters for a function: 3%
– Purpose of functions/blocks of code: 3%
• Program style: 5%
– Meaningful variable names: 1%
– Constants instead of “magic numbers”: 1%
– Readability (complete sentences, indentation, white spaces, etc): 2%
– Code flows “nicely”: 1%
• Program structure: 5%
– Modular code: 1%
– Uses appropriate data structure: 2%
– Loops when needed/no loops when not needed: 2%

More products