A Complete 3D Graphics Pipeline!


I did the original flat triangle shading as required by the project and then extended my Triangle and Pipeline classes to do per-vertex Gouraud shading. The cube.obj file doesn't really take advantage of this, but the rendering of cow.obj is much smoother.

The clipping to far and near planes comes in three phases - trivial rejection, partial polygon clipping and trivial acceptance. For the trivial rejection phase, the triangle is not drawn if all of it's vertices are behind the near clipping plane or beyond the far clipping plane. This works since we are only working with convex polygons, i.e. triangles. The partial clipping is done by clipping the triangle to the near plane and then the far plane. The resultant polygon is then converted into a set of triangles, which are drawn to the screen. Trivial accept just draws the polygon to the screen without clipping it at all.
 


Click on the links below to view the test applets.
NOTE: These applets aren't working with Netscape. Use appletviewer or Internet Explorer instead.

 
  The cube scene with per-triangle shading.

  The purple cow with per-triangle shading.


  The cube scene with per-vertex shading.

  The purple cow with per-vertex shading.
 
 




The class files used in this project are listed below.


For pure entertainment values, here is a picture I grabbed, which I thought was kind of funny. I dubbed it the "Dark Side of the Cow". Also, somehow I was able to grab this picture of a funky cow. There must have been something weird with the color map when I did it.