Notes for April 25

 

Computing and using tangents and binormals

On Thursday we showed how to change a vertex from this structure of 8 values:

   px py pz   nx ny nz   u v
to this much richer structure of 11 values:
   px py pz   tx ty tz   bx by bz   u v
where (tx,ty,tz) is a tangent vector along the surface, and (bx,by,bz) is the binormal vector along the surface, which is perpendicular to both the tangent and the normal vectors.

Once we have both the tangent and the binormal, then in the vertex shader we can simply do a cross product to retrieve the normal vector.

Having these three vectors allows us to do bump mapping properly, since the x,y,z dimensions of the normal displacement that is retrieved from the bump map texture image can now be used as weights (each ranging between -1 and +1) for adding in the tangent, binormal and normal vectors, respectively.

After going over the math for this, in class we implemented it together.

We then began a discussion about blend shapes, in which a vertex can be influenced by more than one transformation matrix. This allows us to create bendable objects, such as finger joints and human faces. We only covered this at a high level. In next Tuesday's class we will go over this topic in greater detail.

All of the code we created in class on Thursday is in shader11.zip.