Doom 3 md5mesh and md5anim Sample Code

A Simple md5mesh/md5anim Animation Demo

Download

md5simple.tar.gz.

About

This is a very simple GLUT program which shows how to load md5mesh and md5anim files and animate them.

The core loading code is in md5parser.h, md5mesh.cpp/h, and md5anim.cpp/h. The core transformtation code is in md5instance.cpp/h, which uses the core loading code. The other files (md5geomsimple.cpp/h, main.cpp) use the core loading and transformation code to produce a small demo application.

This archive also includes the data for a zombie and the space marine, so right out of the box (by typing ``make run'' on OS X) it should produce output that looks like the following image.

Some history

These are resources for loading md5mesh and md5anim files that I tossed together for students taking a graphics class I TAed in Spring 2006. This code was intended to be somewhat incomplete so students could figure out some details on animation themeselves, and I finally got around to fleshing out this reasonably well structured and commented demo about a year later.

There were some bugs in the initial implementation which some students found for me.

A Blurb on md5 formats

A md5mesh file contains a bunch of rigged (controlled through a bunch of rigid joints) geometry. A md5anim file contains a bunch of key frames for those joints. In order to draw the triangles that you'll find in a md5mesh, you'll first need to calculate the vertex positions for those triangles. Those vertex positions are given in terms of transformed joint orientation, so the first thing you'll need to do is calculate transformed joint orientations.

The md5mesh starter code

A md5mesh consists of

The md5anim starter code

A md5anim consists of a bunch of frames, each of which specify each joint's orientation with respect to its parent's orientation.

Some notes

If you have questions, feel free to ask!