## Examples for Assignment 3b

Note: You could hover on any images to see the original(high resolution) ones.

### Perspective Projection

`Renderer.projectVertices = function(verts, viewMat)`
Project the vertices using viewMat, which is composed of the perspective projection matrix and the camera pose.
urls to generate the images:
 The back face of the cube looks smaller than the front face due to perspective projection.

### Phong Reflection Model

`Reflection.phongReflectionModel = function(vertex, view, normal, lightPos, phongMaterial)`
You should apply this equation:

We ignore the emission term (I_E = [0, 0, 0]) and assume the light color is white (I_L = [1, 1, 1]). The following images are generated using the Phong shader.

`Renderer.drawTriangleFlat = function(verts, projectedVerts, normals, uvs, material)`
Compute the face normal as the average of normals of the three vertices. Compute the face centroid as the average of the three vertices. Pass the face normal and the face centroid to the Phong reflection model.
urls to generate the images:

`Renderer.drawTriangleGouraud = function(verts, projectedVerts, normals, uvs, material)`
Compute the color using the Phong reflection model for each vertex. Interpolate the colors of the pixels inside the triangle using the barycentric coordinates.
urls to generate the images:

`Renderer.drawTrianglePhong = function(verts, projectedVerts, normals, uvs, material)`
Interpolate the normals of the pixels inside the triangle using the barycentric coordinates and apply the Phong reflection model.
urls to generate the images: