Home Technical Talk

MD5 format explained.

Frankie V
polycounter lvl 18
Offline / Send Message
Frankie V polycounter lvl 18
I hope someone can help me out.

I’m looking for any information in regards to the animation requirements for the MD5 format in general and setting up a model to be included in the game.

Also I noticed that the animation is in separate files so I was wondering if the engine handles the blending or is a separate sequence required? For example running, running and shooting.

TIA

Replies

  • cptincognito
    Here's a good low level description of the file format:
    http://www.modwiki.net/wiki/MD5ANIM_%28file_format%29

    here's several resources for different idtech4 games:
    http://iddevnet.com/quake4/Animations
    http://wiki.splashdamage.com/index.php/MD5_Export_Process
    http://iddevnet.com/doom3/modelexport.php

    and a pdf describing the complete process, step by step (old one for doom3)
    http://a.parsons.edu/~evan/doom3/exportModelsD3.pdf

    Re: running and shooting
    Almost as important as the .md5mesh and .md5anim files, are the .def files. Entity definition (.def) files are the central hub for the scripts, meshes, animations etc that make up an animated entity in the game.

    It's where you can define animation channels, groups of bones that can be scripted to run animations independently of the rest of the skeleton.

    from http://iddevnet.com/doom3/models.php
    The channel command allows animations to play only on certain joints. For example, you can have a walking animation playing on the legs, a yo-yo animation playing on the torso, and a chewing bubble gum animation playing on the head.
    Scripts in the game control what md5anims play on what parts (channels) of the entity's skeleton, and how they're blended in and out.

    Finally, a good resource for getting help on this stuff is http://doom3world.org it's not what it used to be, but there's still some people around there that can help you out. If, by running and shooting, you're thinking of making a player controlled model (big undertaking) there's an old tut by Vahl here:
    http://wip.global-illusions.com/d3tut/quick%20Tutorial%20-%20Doom3_PPM.htm
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    The engine handles the blending, you can define joint chains as "channels" (eg every bone in the heirarchy above "pelvis" is the "torso channel") then use the state machine to play anims only on that channel... so the "legs" channel can play run/crouch/walk or whatever while the body is playing fire/reload/taunt or whatever else.
    AFAIK you can define as many different channels as you want, but you'll probably need programming support for changing the state machine.
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Wow thanks for the reply guys.

    I just got invited to help out doing the animation for a mod so that is the area that I’ll be focusing on. There was a lot that I was assuming that I knew from an animation standpoint that could mess things up but since the engine does use its own channels and can blend based on a cfg then I can just focus straight ahead and let someone else worry about the details.
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Ok just one last question.

    I’m assuming that a character player model is loaded in based on a default position and then the animation is applied like any other type of motion capture file.

    If that is the case do I need to use a predefined naming convention for the control rig or can I just go ahead and create any necessary control (bones) that I need using my own convention and the animation files with target properly?
  • cptincognito
    Well, it depends on what kind of support you're going to have. A lot of the existing game scripts are going to reference specific joint names. There's nothing stopping you from naming your bones whatever you want, but you're going to have to write a lot of scripts, defs, and articulated figure files from scratch. That's a huge undertaking, so be sure there's going to be someone that's actually prepared to do that.

    The more you can reuse from existing game assets, the better. Following their joint naming conventions will save you a lot of headache, as will following the proportions (if you can) because then you can reuse the af(ragdoll) definitions, which are extremely difficult to deal with.

    That said, there's nothing stopping you from doing whatever you want with your control rig, and then targeting an export rig that follows the standard naming conventions/hierarchy.
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Thanks for that and good point. I’ll be sure that the mod team gives me a SDK.

    One last last question. In the animation portion how are different weapon alignments handled? I noticed that MD5 does not use tags like the older system but does use different cycles on the weapons that are used. Do I just get a copy of the wapon model, use that to align and the engine will do the rest?
  • cptincognito
    Aside from an SDK, you should try to keep in communication with the person that's responsible for handling your animations, and don't go too far without having them put stuff into the game incrementally. Worst thing you can do is make a bunch of stuff that goes unused because it doesn't work ingame.

    The system uses placement joints for orientation- the best way to understand all this stuff is to crack open the example maya files that are included in your game's official SDK. (don't worry just ignore all the code stuff and look at the maya files) If you look at the outliner, you'll see all these joints that are for things like muzzle flash and accessories.

    Quake 4 has the most complete player model rig example of all the idtech4 games (QW is ok too, no control rig though afaik):
    http://iddevnet.com/quake4/AnimationExamples

    Doom3 had a good playerview weapon (different from world weapon) of the machine gun if i remember correctly.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    The system doesn't use "tags" like md3, instead it uses joints (bones) to align objects. So usually wherever you have an attach point (eg. a weapon dynamically in a hip holster, or in the hand), there will be a helper joint in the rig with an appropriate name, and you can bind the weapon model's origin to that joint through the game script.
  • [iWi]
    If You'll not to use Your own animation , then this can help You -

    Replacement player model for ETQW by Paul Greveson (Mop) : :thumbup:

    http://www.3dworldmag.com/page/3dworld?entry=3d_world_114_s_3ds

    tdw114-t_zombie1.jpg

    "fking easy,man" :poly142:
  • cptincognito
    Haven't seen those, very awesome MoP! :thumbup:
  • [iWi]
    Haven't seen those, very awesome MoP! :thumbup:

    Yeah, He likes to play " Hide and Seek ". :poly142:

    I'm a big fan of ETQW -
    Frankie V - let me know something about Your mod , please.
    Any link to this project ?
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Well I just start there to kind of help out in the animation department and some things were mentioned that I don’t have any details on.

    The mode that I’ll be doing all the animation for is called Urban Terror which is based on the Q3 engine.

    So far though it’s been kind of frustrating due to a backwards compatibility problems and the lack of a reliable md3 exporter for the latest versions of Max.

    Personally I much rather have someone else take care of the technical issues but you know how things work over the Internet right? ;)
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    yeah it was a lot of fun doing urt anims and wrangling md3 ;)

    mostly a mix of both the pnf exporter and npherno's skin compiler or whatever it was called
  • cptincognito
    FYI MD3 != MD5

    Unless urban terror is updating their character system, the above links are for MD5, a newer model format (UT is AFAIK quake3, which uses MD3)
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Ya it was only kind of sort of mentioned that they could be or possibly be doing something in the area of MD5 in the near or late future. In other words probably when the D3 engine goes open source.

    This is really just for my own knowledge base as I’m familiar with the md3 construct and not the MD5.

    Of note is there a tutorial I can look at that explains how to get custom weapon models into the Q3 or ioQ3 engine? I can do player models no problem but I’m having some difficulty with weapons.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    the ingame weapon system for urbanterror was a custom solution, as q3 orignally had no animated weapons at all. I came up with the pseudo rigid bone solution using tags to reduce memory footprint in urt myself and apoxol coded it. I told BladeKiller already if you need detailed information how to do it you can always email/pm/icq me.

    in general it works like this:
    have 1 scene with your animated hands + weapon
    every animated weapon piece is linked to a tag which you use for animating it (tags can be linked to whatever you want again).

    export the hands + tags as animated md3 (all frames). But dont export the weapon mesh as part of this, else it costs too much memory!

    then export every rigid animated part with its tag in its own file using some naming convention (dont remember exactly but you should see from the other files). It is important that each tag/part is placed at origin and without rotation (ie world aligned), because it will be later linked to the tags in the animated hand file.

    so your result is like
    gun_hands.md3
    gun_part_clip.md3
    gun_part_trigger.md3 ...
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    q3 had animated weapons, the machinegun spins round! (although like you say that was handled in code through the tagging system)
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Thanks for the info CB but I’m not sure if it is still required to do it that way. At least TwentySeven has informed me that it is no longer required and doing it all as one file is fine.

    I do have it all setup as one large file using *_hold.md3 and it all seems to work fine when I have it in game but if your recommending that it still be done this way I can always add the extra once I’m ready to finish it up.

    I’m kind of thinking that memory use to be a consideration but not so much as compared as today.

    Also BK told me that you would be willing to help out in a crunch so I’ll keep that in mind if I find myself in a hole.

    Just a question can you tell me under which directory to place all the working directories so I can then delete the pk3 file and work from there? It’s been ages since I worked with md3 and my memory is not as good as it use to be.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    been ages for me too ;) last time I did stuff like that was 2002
    but pk3 can simply be extracted inside the mod directory.

    well even if memory is cheap nowadays, when all other guns are stored efficiently why not do for the new ones either... but I leave that decision to the people in charge these days, and if 27 says that other stuff sucks far more much ram that this is negligable then it really might not be worth the effort...
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    Well actually the more I play with it the better I’m understanding the brilliances of the logic. It’s frustrating as hell as I’m finding out, as only a handful of people seem to know the construct of the custom tag system being used.

    Something I think is a problem doing it the way I was putting it together is the <>_hold.md3 file does not support the application of textures base on the shader path contained with in the md3 file. It only applies what is contained in the .skin file.

    Can you confirm this?

    All in all though going old school is probably the best solution to maintain consistency as well as file size. The largest file is about 500K for the hold and the rest come in at 35K with most in the 1 to 2 K region. I compile everything as one file I land up with about 3.5 meg. Not a big number in this day and age but the extra 3 megs could be used better else where.

    Once I get into player animation though I’ll probably have to give you a shout. There seems to be some custom additions there as well.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    dont remember how the skin stuff worked, but yeah it makes sense as you describe it.

    as for the player models, the only thing that is custom I think are the weapon tags. maybe the body armor was also animated in a separate file, not sure. The "fun stuff" customizations was added after I had left, so dont know what it is based on. Also I recall BK doing the last round of animation exports. The last slightly improved animation set I did never made it into the game, along with that one shotgun back then.

    The hard split with just upper/lower body is really ugly in q3 if you can get them to improve the system there, would rock. I once thought of not making the upper/lower split at hip but more at shoulder level, as looking up/down would mostly affect arms and head. But without deform skeletal bones that is very ugly to pull off, and mostly requires seam hiding models.

    if you really redo the player animations, I would suggest you go for md5 or whatever, cause imo one cannot improve a lot when it comes to realistic motions and the up/down look issue. You really would want to have some smooth bone control.
  • Frankie V
    Offline / Send Message
    Frankie V polycounter lvl 18
    I pretty sure that’s what they did. Looking at the model it does have what looks like the standard torso tag but just up from that is another, what looks to be, pivot tag. What I’m assuming at this point is the engine ignores the bottom row and instead pivots at the upper hips. That would explain why I’m scratching my head as to why there are no end caps for the segmented parts.

    As for md5 ya I’m hoping and it only makes sense that the engine would go in that direction. Md5 in an open source engine would kick ass. I’ve seen a few demos for version 4.2 and they are doing some really amazing things with bump and spec maps.

    It will mean more animation work, which is what I want to do, but pluging in new animation would be far easier and any updates could be batched process with out having to go back and key frame “everything”.
  • odium
    Offline / Send Message
    odium polycounter lvl 18
    We have .md5mesh and .md5anim working perfectly in OverDose guys, you should contact our coder Nicolas for more info maybe he can share code with you? But yeah, fully tested using Doom3 and Quake 4 rigged models. You can see it in the OD Tech demo videos. (OverDose was based on Quake 2 code)

    http://www.teamblurgames.com/overdose/
Sign In or Register to comment.