Exercise Solution

Part 3

The next step is to load the OBJ file. (...)

Set up the camera and draw your 3D object as an indexed face set using a simple set of shaders.
Please use a browser supporting HTML5

Part 4

Set up a light source and use your shaders from Part 5 of Worksheet 4 to shade the object using Phong shading and the Phong illumination model.

Explain how you obtain and use surface normals, and explain how this relates to the surface smoothness when you are rendering a triangle mesh.

-------------------
Answer
I obtain surface normals from the OBJ file. The normals (for each vertex) are passed to the vertex shader, which in turn passes them to the fragment shader as varying variables. This is the basis of Phong shading - the normals get interpolated across the polygon faces, resulting in smooth lighting.
Please use a browser supporting HTML5
K_ambient      
K_diffuse      
K_specular      
Shininess      
Light red      
Light green      
Light blue