Thursday, April 2, 2009

Project 2 Obj Viewer

Here are some screenshots of my .obj viewer. The first screenshot is of a skyscraper model. I included an algorithm to calculate the face normals. I just set them perpendicular to the face plane. My program only handles models that have been triangulated.

The second screenshot shows the teapot model, which I am sure everyone is tired of seeing. The shot on the left shows the teapot with normals turned on, and the shot on the right shows normals turned off.
The final screenshot shows the F22 model I did for CSC 220. Maya does not seem to "wind" all of the faces counterclockwise when it exports .obj files, so some of the normals are pointing in the wrong direction. The first shot shows the F22 with normals turned off. I also changed the colors using the R G and B keys.


Finally here is a link to my final version of the
OBJViewer. This version only works when you drag and drop a .obj file onto it. Models that are not triangulated will not look good.
The camera does not work perfectly, sometimes it will turn completely around.

Keyboard Instructions:
HOME: Resets camera to origin
Arrow UP/DOWN: moves the camera forwards and backwards in whatever direction you are facing
Arrow LEFT/RIGHT: Rotates left and right
INSERT/END: Pan left and right
R G B: change colors (reduces r g and b values)
M: toggle background black/white
N: toggle faces normals

Thanks to: lighthouse3D for this tutorial on using a vector for camera control with gluLookAt();
Thanks to: Richard Sabbarton for writing this article on Calculating normals