# md3 animation

This topic is 4319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm working on an MD3 renderer, but I'm confused on how animation works. Each surface has a list of "frames", but these frames do not have any corresponding vertex/triangle information which would denote the state of the mesh at that time. Does anyone know of any MD3 animation documentation? The only site I can find on the subject is GameTutorials, but unfortunately at this time spending \$20 for potentially a few sentences is not possible. Basically what is happening is I am rendering every triangle in all surfaces for a model, which gives me: This appears to be the first frame of the death animation, but I cannot be sure. If it is, I'm utterly confused on how to iterate to the next frame (at this time I am not concerned with interpolation, just getting to the next key frame). I got most of the MD3 format specifications from this site, which it does not discuss how animation is stored - notice the "frame" object is only constructed with:
struct md3_frame_t {
struct vec3_t min_bounds;
struct vec3_t max_bounds;
struct vec3_t local_orgin;
char name[16];
};


My original post briefly touches on this issue at the end. This is a bit of a cross-post (sorry), but I don't think "Game Programming" was the correct forum to post in. I think any follow-up questions would be best suited here. Any help would be great appreciated. Thanks! [Edited by - para45 on April 24, 2006 5:14:23 PM]

##### Share on other sites
<whisper> psssst. I found this in the Surface table </whisper>

Quote:
 List of Vertex objects usually starts immediate after the list of St objects, but use OFS_XYZNORMALS (+ OFS_SURFACES). The total number of objects is (NUM_FRAMES * NUM_VERTS). One set of NUM_VERTS Vertex objects describes the Surface in one frame of animation; the first NUM_VERTS Vertex objects describes the Surface in the first frame of animation, the second NUM_VERTEX Vertex objects describes the Surface in the second frame of animation, and so forth.

Hope I helped. Good night.

##### Share on other sites
Wow, it's unbelieved that I forgot about that. Thanks!

Just one more quick question though.
I read over the documentation twice more to make sure I didn't miss this, but the solution not popping out at me.
Each surface has only one tag specifying how any child body parts should be translated to connect.
If a frame modifies where the child body part should connect (lets say the model falls to his knees, now his waist is lower), there is no corresponding tag that indicates where this new translation should be for the body.

So as the legs fall the body is in the same position it would have been before the waist lowered.

I took a look at a member of the frame called "local_origin", but it appears to be used for culling(?) and does not appear to be relocating the body to fix with the fallen waist.

##### Share on other sites
Ok I got the animation working so that the body parts align during each frame.
However this is an unusual thing that occurs when something like the death animation is played. Normally the character will fall to his knees and then his face and torso will fall to the ground. However I am experiencing that the legs fall correctly, but the upper body and head are still vertical and do not fall to the ground. It does not seem like the animation should need to be manually rotated, it should be in the model already -- these frames are designated as the "death scene" after all.
Any ideas on this?

It looks like..

This is the end of the sequence and the torso should be flat against the ground along with the legs.

----the solution to my previous post----

It's fairly obvious each tag must be updated for each frame.
There are actually (num_tags * num_frames) tags beginning at the ofs_tags offset.
The first num_tags is assoicated with the first frame, the second num_tags the second frame, and so forth.

Unfortunately the documentation at http://linux.ucla.edu/~phaethon/q3a/formats/md3format.html would lead you to believe there are only num_tag tags within the file - doh.

Also the tags must be linked, where the translation for the head must be used from the "tag_head" tag from the body.

[Edited by - para45 on April 24, 2006 5:35:46 PM]