Archived

This topic is now archived and is closed to further replies.

Dirk Gregorius

MD3 tags and skins

Recommended Posts

Hi, I haveuple of questions regarding the md3 format. 1. Is a whole md3 model always assembled from the legs, torso, head and weapon or can there be arbitrary variations? 2. Can several models be attached to a tag or only one? 3. In most papers the transformations from the tags in the legs are applied onto the torso so let me call this unidirectional. But shouldn''t this be done vice versa as well - bidirectional. For example: Of course you have to apply the combined transformation from the legs and the torso to render the weapon at the correct position. On the other hand the weapon could move the whole body back and forth when firing. So would it make sense to apply the transformations of the weapon on the linked parts as well? Maybe somebody can post pseudo code how to apply the correct transformations for each model, something like: for (each model) UpdateTags(); for (each model) GetTransformationFromLinkedModels(); CombineTransformations(); ApplyTransformations(); ... And if this is the case for the torso I would get three tranformations, from the head, the weapon and the legs. I simply add the translations, but in which order do I apply the rotations? 4. Each model comes with a .skin file. These files have the following structure: SomeKindOfId, TextureNameWithPath If saw models where "SomeKindOfId" was a mesh name also I saw .skin files where "SomeKindOfId" was related to a tag? I really need some enlighting here. Every help is greatly appreciated!! -Dirk

Share this post


Link to post
Share on other sites
Although Q3 uses the legs/torso/head/weapon/flash pattern, it''s perfectly possible (if maybe violating a standard) to use other tags in MD3 files. I am using this liberally to use MD3s in my game, using my own tag definitions for more complex objects, in addition to tag_torso, etc.

For transforming to the proper tag location, I use the legs as the "base" model to be drawn, then I simply transform into the torso via tag_torso, then draw the torso. Then push the current transformation, transform into the head, draw the head, pop the transformation, transform into the weapon, draw the weapon, if they''re firing, transform into the flash, draw the muzzle flash, pop the transformation. Now your whole guy is drawn. Although like I said, later I will have additional tags to make a more complex hierarchy.

As for if multiple models can be attached to a single tag--yes, there is nothing stopping you from drawing more than one model at that particular transformed location.

As for skin files, I can''t help you there. I''m just using the MD3s for geometry; I use my own animation script system and shader system.

Share this post


Link to post
Share on other sites
Hi Omaha,

thanx for your reply. You describe what I call the undirectional path. Did you tried to apply the transform defined in the tag_legs in the torso model onto your leg model? This works - I just tried it out. Then I looked into the matrices and found out that this model only contains identity matrices.

Maybe I formulated myself not very well, so I try it another way:

I know how to use the torso_tag in the lower_model, and I know how to use head_tag and the weapon_tag in the upper model. I simply apply the transformations onto tthe attached models. What I don''t understand is how to use legs_tag in the upper model and how to use the torso_tag in the head model and finally how to use the torso_tag in the weapon model.

I somwhere read in this forum that you have to combine the transformations of related tags. Does somebody know more about this?

-Dirk

Share this post


Link to post
Share on other sites
I''m not sure about tag_torso in the weapon but I think technically you are supposed to line up tags of the same name in linked models, for example, draw the legs, transform to tag_torso, switch to the torso model, transform to the torso''s copy of tag_torso, THEN draw the torso.

I could be wrong, my MD3 usage is probably highly unorthodox. I will just enforce that all submodels of one object (the head/torso) be drawn relative to the origin, that way when the tag transformation takes place everything will be in the right new spot.

Share this post


Link to post
Share on other sites