Doom 3 Model Importer and Renderer

Doom 3 Model Importer and Renderer

Project Description

My final project allows you to make any animated model in the animation program Maya and input your animated model into your OpenGL world.

I initially wanted to load Unreal's file format called .PSK and .PSA to read in the model mesh and animation, but because it was too much of a pain to write a loader for a binary file, I decided to go with the Doom's file format .MD5 and .MD5ANIM. I implemented an exporter from Doom 3 that takes my .MB Maya 2010 file and creates a .MD5 and .MD5ANIM file. I then implemented a .MD5 and .MD5ANIM importer which reads the .MD5 and .MD5ANIM files
My project can view models in wireframe with and without textures. To demonstate the extent of what my project can do, I have a simple cube binded with a skeletal mesh that bends and rotates creating a stretched and morphed effect.

Technical Aspect

MD5 is a format specifically made for Doom 3 that
- Model's geometric data
- Stores skeletal animation
- Supports vertex skinning
- Supports Texture mapping
- Uses quaternions for orientation

Quaternions
Quaternions are mathematical objects that represent orientation. Quaternions are alternatives to matrices for representing a rotation. Quaternions can't hold information on position though. You use quaternions to calculate the final position of the vertices since the MD5 files do not hold the final vertices.

MD5 Mesh
MD5 Mesh files contain data of:
- Vertices
- Triangles
- Vertex weights
- Texture name

MD5 Animation
- Skeleton hierarchy with flags for each joint for animation data
- Bounding box for each frame of the animation
- Baseframe skeleton from which the animated skeleton is computed
- A list of frames, each containing data to comput a skeleton from the baseframe skeleton

Skeleton Interpolation
To animate the model, I had to calculate the current frame to draw, and update the elapsed time from the beginning of the current frame. I then had to interpolate the currrent frame's skeleton with the next frame's skeleton. The percent of interpolation is obtained by multiplying the elapsed time since the current frame changed by animation's frame rate.

References

People to Thank
Paul Phu
For being an awesome resource throughout the entire project.
He gave me a lot of good pointers on how to go about exporting my models into MD5.
Allen Park
For getting me out of stucks when my models were complaining.
Bill Hess
For giving me some good resources from the beginning to set me on the right track.
Zoe Wood
For calming me down when I began to panic.

Maya to MD5 Exporter
http://www.modwiki.net/wiki/Maya_to_MD5
http://www.modwiki.net/wiki/Export_(decl)
http://www.modwiki.net/wiki/MD5_(file_format)

Maya Importer
http://modetwo.net/darkmod/index.php?/topic/9876-problems-with-greebos-mayaimportx86dll
http://www.doom3world.org/phpbb2/viewtopic.php?f=3&t=24083&view=previous

Maya Loader
http://tfc.duke.free.fr/coding/md5-specs-en.html