CS 455 Lecture 8 – Calculating Normals


  • what ?s
  • finding Playdoh normals
  • finding normals of a model

Think About This

Here’s what you know:

  • The positions of five vertices.
  • Connectivity information (e.g., vertices 0, 1, and 2 form a face).
  • Vector operations: you can add 3D quantities, subtract them, take their dot product (which tells you the cosine of the angle between them), their cross product (which produces a vector perpendicular to its two operand vectors), make them have unit length, etc.

Now, do this:

  1. Take a canister of Playdoh.
  2. Create three triangles made of five vertices.
  3. Model how one might determine the normals.


Let’s generalizing our shading routine to work with an models, not just spheres. Complete the following steps as a lab exercise, and email me a screenshot of your shaded model.

First, sync and pull the changes down from Bitbucket.

In the OBJ reader routine:

  1. Add an out parameter for the vertex normals, a list of Vector4s.
  2. Allocate adequate space for these normals, and zero them out.
  3. On reading a face, mentally label the vertices A, B, and C.
  4. Find two vectors tangent to the face (like B – A and C – A).
  5. Calculate the face’s normal as the cross product of these two vectors. Normalize.
  6. Add the face’s normal on to the normal of each of its three vertices.
  7. When all geometry has been process, renormalize the vertex normals.

In the Initialize routine:

  1. Upload the normals as another vertex attribute. &normals[0][0] gives you a pointer the first normal’s x-component.
  2. Load in suzanne.obj or some other non-sphere model.

In the vertex shader:

  1. Declare the normal as a second vertex attribute.


Why did u cross v?
To get to the other side?
No, that’s reflection

So why did they cross?
To get where neither could get
In and of themselves


Leave a Reply

Your email address will not be published. Required fields are marked *