Advertisement

md3 info (not code based)

Started by February 26, 2002 09:21 AM
11 comments, last by dachande 22 years, 11 months ago
Hey, I am interested in using the .md3 model format in my application. Can someone give me an explanation of how these models work, and how they are created? I get the impression that they contain 2 or 3 models inside the one file so that different animations can occur on different parts (legs, torso, head). But I might be wrong - I can''t find any info concerning this. How would I (or my modeler) go about creating md3''s in something like Milkshape? how do you differentiate between the different parts of the body etc.. and lastly if you have time it would be nice to know how the tagging system works too... connecting weapons to arms and similar. Thank you for your time, any information would be appreciated, Dachande
"Can someone give me an explanation of how these models work, and how they are created?"

Ok well I can''t exactly give you specifics because I dont have any reference material on this computer, however I think I remember the general way they work... Basically, a model is comprised of the head, the torso and the legs. Each of these parts are individually modelled and animated but they share the same texture map. The different parts are linked together using a script which defines what is attached to what.


"I get the impression that they contain 2 or 3 models inside the one file so that different animations can occur on different parts (legs, torso, head). But I might be wrong - I can''t find any info concerning this."

MD3 files do not contain several models inside each file, but MD3 models are animated using a bone system. A ''bone'' is basically a matrix, it is a transform which is applied to the vertices associated with the bone (Stored in the model file) and the bones are stored in a hierarchy so the transform the hand you first transform it by the lower arm which is first transformed by the upper arm etc...


"How would I (or my modeler) go about creating md3''s in something like Milkshape?"

Check Milkshape''s homepage (www.milkshape3d.com) and go to the tutorials section. A few articles about making MD3s on there - though I personally have never checked out the Quake3 specific tutorials, but they should answer a lot of your questions.


"how do you differentiate between the different parts of the body etc.. and lastly if you have time it would be nice to know how the tagging system works too... connecting weapons to arms and similar."

Well, for a start the different parts of the model are stored in seperate .md3 files! :D

Check out Lonerunner''s page (Link on NeHe''s front page) for working source.



-------- E y e .Scream Software --------
----------------------------------------
                                  /-\
    http://www.eyescream.cjb.net | * |
                                  \-/
----------------------------------------
Advertisement
quote:
Original post by TheGilb
Ok well I can't exactly give you specifics because I dont have any reference material on this computer, however I think I remember the general way they work... Basically, a model is comprised of the head, the torso and the legs. Each of these parts are individually modelled and animated but they share the same texture map. The different parts are linked together using a script which defines what is attached to what.


The head/torso/legs are each in their own .md3 file. Their skin is defined in a .skin file (not always the same texturemap for each part) which specifies the shader for it. The models have 'tag' polygons, which link them together.

quote:
Original post by TheGilb
MD3 files do not contain several models inside each file, but MD3 models are animated using a bone system. A 'bone' is basically a matrix, it is a transform which is applied to the vertices associated with the bone (Stored in the model file) and the bones are stored in a hierarchy so the transform the hand you first transform it by the lower arm which is first transformed by the upper arm etc...


MD3 files are not skeletal. They dont contain bones, rather they contain hundreds of vertice meshes, 1 for each frame of animation.

Check http://www.hellkrisp.com for source to an md3 viewer

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack

Edited by - Maximus on February 27, 2002 9:35:08 AM
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Thank you both for your information and links, they have proven very useful:

Can I just get a clarification check on the skeleton bit?

Do .md3''s use a skeletal animation system? I assumed that they would, but feel free to prove me wrong,

Thanks,

Dachande
Hi

I''m no expert but I heard that MD3 files contain skeletal information but it was never used in Quake 3.

So both of the above posts are sort of right.

"To err is human, to really mess up requires a computer"
"To err is human, to really mess up requires a computer"
Md3 files contain no skeletal information at all. You are probably thinking of how Quake3 supports both Md3 AND Md4 models, Md4 being a skeletal format supported by the engine but not used in any of the games content.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Advertisement
but they include something called "Boneframes"
I hate signatures !!!
The structure information is rather misleading. The numboneframes entry is just the number of animation frames in the file.

Md3 files are just vertice meshes of every frame saved to the file. They arent skeletal. id software added MD4 support to the engine so that the engine did have a skeletal format to use.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
I feel there is a little confusion on this subject

To expand on the original question:

How do md3 map objects and weapon models work if md3''s have 3 tags and 3 different sections?

thanks,

Dachande
quote:
Original post by dachande
Hey,

I am interested in using the .md3 model format in my application.

Can someone give me an explanation of how these models work, and how they are created?



To figure out the MD3 File Format I downloaded Aftershock and looked at the structs in md3.c and md3.h. The structs are pretty self explanatory but Aftershock does not (at the time of writing) support animation, and nor does it appear to cater for tags. However, adding animation support is trivial (see the source to my program, MD3View). Both programs are licensed under the GPL.

To clear up, MD3s are divided into meshes. Each mesh has its own shader and its own set of vertices. Along with the vertex/tex-coord arrays is an array of unsigned integers which has 3*numtriangles elements. Each uint in this array refers to a particular vertex and texcoord, and a set of three elements of the array refer to a single triangle of the mesh. For some reason this is called an element array

When drawing the model one should loop through the meshes of the model, and for each mesh, loop through the the element array, and from the element array, the program should draw the index for the current vert from the vertex array, eg vertarray[elementarray];. This index should also be used to grab the texture coordinates.



This topic is closed to new replies.

Advertisement