## Interactive Computer Graphics: Assignment 6

### Lighting, Materials, Gouraud and Phong Shading

Topics:

• Color: RGBA
• Gouraud and Phong shading algorithms
• Diffuse, specular and ambient coloring
• Specifying light sources
• Specifying materials
• Calculating interpolated normals
• World and camera coordinates

1. Average the normals for each face to create a unique normal for each vertex.

2. Implement the Phong shading model.

3. Illuminate your geometric model with at least two point lights.

4. Implement both Gouraud and Phong shading algorithms.

5. Allow the user to interactively select either Gouraud and Phong shading.

6. Allow the user to choose the material properties of your model from a pre-defined list of at least three materials.
The three materials should be significantly different, i.e. don't just change the color. You should also change the shading properties.

7. One of your materials should produce a bright white specular highlight similar to the example below.

One of your materials should have the following properties:

• material_ambient = vec4(0.6, 0.2, 0.2, 1.0);
• material_diffuse = vec4(0.9, 0.1, 0.1, 1.0);
• material_specular = vec4(0.8, 0.8, 0.8, 1.0);
• material_shininess = 80.0;
• light_ambient= vec4(0.2, 0.2, 0.2, 1.0);
• light_diffuse = vec4(0.6, 0.6, 0.6, 1.0);
• light_specular =vec4(1.0, 1.0, 1.0, 1.0);

When I load bound-lo-sphere.smf I should see an output similar to the one above. (One sphere of course.)
When I switch between Gouraud and Phong shading, the output should switch between the two above spheres.

8. Similar to your camera, place one of your lights on a cylinder around the object and allow the user to change the light location by modifying the angle, radius and height of the light's location.
The light should only move when the user changes its location. This light should be defined in the coordinate system of the object.

9. The other light should be defined in the camera coordinate system, i.e. it moves with the camera, and it should be located near the eye point.

smf files can be found here.