OBJ Loader and Texture PPM

I worked on the OBJ loader to correctly import the normal vectors, texture coordinates, and vertices so that I can start exporting models from max to my renderer. Here are some comparative shots with a texture map applied, the uvw coordinates give us a way of mapping two dimensional coordinates u and v to the surface of the three dimensional model. The w coordinate equal to zero of course, only making red and green visible, and a mix (yellow/orange) across the surface. Lastly, we have the world space normals, which in this case is the same as the object space normals. It gives us an indication of the direction the polygon is facing and is perpendicular to the vertex. It is useful for lighting or smoothing the appearance of an object.

I have worked on being able to load textures/images and save them, original I used the *.ppm file format here, but I have switched from the magic number P3 (ASCII) representation to the representation with magic number P6 (binary) since Photoshop can only save out to this representation. I also had some headaches trying to parse this file format since there were some strange bugs that I could not figure out, but as it turns out it was something stupid, like forgetting to make sure all the white spaces were eaten up since there was a sneaky newline character produced when saving from Photoshop.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s