Program6

You must complete Program5 before beginning Program6. Use your finished Program5 as a base for Program6.

Add code to your new Program6 to shade the models with Phong reflectance and Gouraud and Phong shading.

Constants

The uploaded uniforms are these values:

uniform mat4 P;  //projection matrix
uniform mat4 C;  //camera matrix
uniform mat4 mT; //model transform
uniform mat4 mR; //model rotation
uniform mat4 M;  //modelview matrix: M = C * mR * mT
uniform mat4 N;  //inverse transpose of M
uniform mat4 L;  //light rotation matrix

Todo:

Hints

Program 6 Rubric
Vertex normals computed, uploaded, and used as colors -1 : No normals 0 : Face normals only 1 : Correct vertex normals
Ambient reflectance 0 : No ambient 1 : Ambient reflectance
Diffuse reflectance 0 : No diffuse 1 : Phong diffuse term correctly uses normal and light vector
Specular reflectance 0 : No specular 1 : Phong specular term correctly using view and light vector
Light rotation 0 : Incorrect rotation 1 : Correct reflectance for rotating light
Object position transformation 0 : Incorrect reflectance after transform 1 : Correct reflectance after transform
Object normal transformation 0 : Incorrect reflectance after transform 1 : Correct reflectance after transform
Flat shading 0 : No shading 1 : One reflectance per triangle, no interpolation
Gouraud shading 0 : No shading 1 : One reflectance per vertex, then color interpolated
Phong shading 0 : No shading 1 : Normals interpolated, then a reflectance per interpolated normal
Completion 0 : On due date 1 : Before due date

Example cube images (normal, flat, gouraud, phong):



Example sphere images (normal, flat, gouraud, phong):



Example teapot images (normal, flat, gouraud, phong):