Homework 9, due Wednesday, Nov 6.

Look at the very simple implementation of a zbuffer in: http://mrl.nyu.edu/perlin/zbuffer/

This code shows everything you need to zbuffer polygons, and it also contains a simple placeholder vertex shader method.

Your assignment is to integrate this zbuffer capability together with the geometric surface meshes you built for homework 7, and also to replace the simple placeholder vertex shader routine with your real phong shading routine.

One important thing to note: To transform a surface normal, you need to multiply it by the transpose of the inverse of the matrix that you would use to transform a surface point. Feel free to use the matrix inversion method that I provided in the Ghost example.

Click here for an answer to the following question:
If a vertex V is transformed by a matrix M, why do I need to transform the associated normal vector N by the transpose of the inverse of M?

When you are done, you should be able to display shaded solid objects.

This version will run somewhat slowly, since the simple zbuffer implementation that I'm providing is not optimized. As part of the assignment that follows next week, we'll make it all run faster.

As always, feel free to make interesting and fun content to show off the capabilities you are implementing. You always get extra credit for cool content and great visual design.