Jump to content


Photo

MD5 models and animations (Blender)

md5 export import animations modeling

16 replies to this topic

#1 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 11 April 2018 - 04:20 PM

Hi, I thought I should document this discussion here, for future reference, as info on this subject has become quite scattered and out of date.

 

I've been wrestling with MD5s for a while now with no success. Importing works but the meshes and armatures are problematic. I decided to start with an animated model from scratch. Followed a few instructions in videos or tutorials (most recently trying out Sotha's solution http://forums.thedar...pc/#entry325423 ) but have yet to be able to export successfully. The animation oddly enough is working correctly (on the model viewer, havent gotten into the game yet), but the mesh itself is getting horribly deformed.

 

Im using the io_scene_md5 importer/exporter. Going back to version 2.72 didnt solve it for me.

 

In blender

 

Attached File  tree1.jpg   26.5KB   0 downloads

 

After exporting

 

Attached File  Untitled.jpg   30.44KB   0 downloads

 

Any thoughts?  

 

 

 

 

 


  • Epifire likes this

#2 Arcturus

Arcturus

    Advanced Member

  • Development Role
  • PipPipPip
  • 1643 posts

Posted 12 April 2018 - 03:09 AM

Could you attach the .blend file?


It's only a model... /// My channel on YouTube


#3 Epifire

Epifire

    Advanced Member

  • Active Developer
  • PipPipPip
  • 540 posts

Posted 12 April 2018 - 04:10 AM

Hard to say as I haven't actually made the scary venture into MD5s, but does the game expect an explicit hierarchy for the bone setup? It would explain the strange deforming but that would be my first guess. Thing that gets me is every engine I've dabbled with animations for, have their own proprietary implementation. The result being quirks that need tending to else strange errors persist. Needless to say I'm very interested in seeing what could resolve in your case here.


You need a model? Epi does you a model.

 

Toss me a PM I promise I don't bite.

 

 


#4 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 744 posts

Posted 12 April 2018 - 08:13 AM

First can you explain how you made the skeleton? Have you called the root bone "origin"? That is very important. Are you sure all vertices of your model are weighted to a bone correctly? I assume that is open3mod? Try ingame or try to see the model in another md5 viewer, like Noesis for example, in my experience Noesis can see Md5 models and animations that make open3Mod crash, imo i also think Noesis is a better tool overall.


Edited by HMart, 12 April 2018 - 08:15 AM.


#5 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 12 April 2018 - 11:26 AM

HMart - thanks for the suggestion. Indeed Noesis imports the model and it looks correct! I can see the armature in there with the mesh, and I can play the animation separately, working fine. Unfortunately, it seems you cant have them both at the same time, I can only inspect the mesh or the animation at one point, would be great to see them working together. I was using open3mod and it still shows a heavily deformed mesh. Now I have no clue if the problem is in the mesh or the viewer.

 

Attached File  Untitled.jpg   34.07KB   0 downloads

 

The armature is a simple FK one from the ground up, the first bone being called origin (no parent) and 3 or 4 more bones from that. Its true, I was reading that vertex groups and weights are a problem for the exporter, but it all seems correct to me (bones and vertex groups have the same names, cant see any issues on weight painting mode, etc). Obvisouly theres something Im missing. I parented the mesh to the armature with automatic weights. Tried renaming everything with simple short names (materials, objects, bones, etc). The process I used for exporting was the one described by sotha, with the exception that I set the bones layer on 1.

 

Arcturus - Im linking the blend file, in case you have some time to take a look, thanks a bunch. https://1drv.ms/u/s!...cgfKkF6bQ179nBc

 

Epi - Tackling MD5 is kinda scary for sure. The modeler version and plugin version combo alone will keep you guessing for a while. I dont think the armature hierarchy is essential in this case, though you do need a root bone called origin located at zero, like HMart said. I think the rest is pretty much free? Hopefully as I progress with it I'll be able to post enough info to help others with this process.


Edited by RPGista, 12 April 2018 - 11:30 AM.


#6 Arcturus

Arcturus

    Advanced Member

  • Development Role
  • PipPipPip
  • 1643 posts

Posted 12 April 2018 - 04:10 PM

I exported model and animation using this plugin (Blender 2.79b):

 

Attached File  md5_plugin.PNG   18.97KB   0 downloads

 

It works fine in game. Here are md5 files.


  • RPGista, Epifire and Anderson like this

It's only a model... /// My channel on YouTube


#7 Epifire

Epifire

    Advanced Member

  • Active Developer
  • PipPipPip
  • 540 posts

Posted 12 April 2018 - 11:08 PM

I've really wanted to animate stuff for a while, I just didn't wanna bite the bullet and learn Blender. However, I think I could settle for importing a finished model and animating it from there. Thanks for linking the tool Arcturus!


You need a model? Epi does you a model.

 

Toss me a PM I promise I don't bite.

 

 


#8 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 13 April 2018 - 12:38 PM

Yeah, thanks a lot Arcturus, I guess the process is actually working then, should be able to test more stuff in game soon now. And Epi, yes, if you cant find an exporter for your favourite modeler, Blender is always there, and it has pretty good animation capabilities. A bit of a learning curve to get there, but nothing you havent seen before.



#9 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 744 posts

Posted 13 April 2018 - 01:10 PM

I remembered that i have a old viewer for model/animations made specially for idtech 4, is called "modelviewer093a" and I made a link for it here https://drive.google...hZp7OaLbk4-UgjZ.  Is old so to make it work well in W10, you need to set it to start as administrator and perhaps even set the compatibility mode for windows XP sp2/sp3. You also need to edit the file "scene.txt" and give it the link for the base folder.
 
The good thing about this old model viewer is that it supports basic Doom 3 shading capabilities, (stencil shadows, per-pixel lighting, normal mapping, specular) so you can see the models almost like they look ingame. 
 
About Noesis i also don't know how to make it play MD5 animations with the models, it does that for collada and fbx models, it seems it needs the animations to reside inside the same file has the models, but i could be wrong. Noesis also has a nice extra tool in the "tools" menu option called Data viewer, in there you can, not only change program settings but also see the bones names, nice to see what naming convention idSoftware used for their bones and you can also edit the bones xyz values directly in Noesis!


Edited by HMart, 13 April 2018 - 01:12 PM.

  • RPGista likes this

#10 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 14 April 2018 - 11:24 AM

I was using that modelviewer before but it was so unstable, cheers for the reminder, I completely forgot to set it to compatibility mode. It seems a bit more workable now. It loads the tree model and animation successfully. 
 
Arcturus, sorry to be a pain, but do you mind posting the def file you used to test the tree in game? I have been using the flag and your tree ones as examples, but I cant get the model to appear in game. They look fine in DR but wont show up once I load the map.

 

Heres the one I tried last:

 

Spoiler

 

Im getting a NULL JOINTS on the mesh warning.


Edited by RPGista, 14 April 2018 - 12:00 PM.


#11 Arcturus

Arcturus

    Advanced Member

  • Development Role
  • PipPipPip
  • 1643 posts

Posted 14 April 2018 - 12:46 PM

Sure, def file is:

model tree_anim_test2a1exp1
{
mesh models/md5/nature/tree_anim_test2a1exp1.md5mesh
anim idle models/md5/nature/tree_anim_test2a1exp1.md5anim
}
entityDef atdm:tree_anim_test2a1exp1
{
"editor_displayFolder" "Nature"
"spawnclass" "idAnimated"
"model" "tree_anim_test2a1exp1"
"start_anim" "idle"
}

  • Anderson likes this

It's only a model... /// My channel on YouTube


#12 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 16 April 2018 - 02:26 AM

*
POPULAR

Good news boys, I was able to get the hang of it, Im bringing several test models in game - so far, I found Keless exporter to be quite reliable, been using it with the 2.72 version to do the exporting. Will do more testing with the Arx one later.

 

Attached File  startmap_2018-04-15_00.33.26.jpg   88.6KB   0 downloads

 

Attached File  startmap_2018-04-16_04.02.44.jpg   52.63KB   0 downloads

 

Will be posting a quick guide soon, with the needed details. Thanks again. 

 

 

 


  • Springheel, Dram, Bikerdude and 6 others like this

#13 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20227 posts

Posted 16 April 2018 - 03:43 AM

Nice one!



#14 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 29 June 2018 - 03:47 PM

Ok, so Im gonna post a WIP tutorial on how to export MD5 models and animations from blender to TDM. Its pretty rough, I will be polishing it as I go along:

 

A couple of guidelines:

 

- The mesh needs to be valid and clean with triangulated polygons;

- It must be UV unwrapped and have a material applied (with one texture image);

- Apply all transformations and modifiers before binding it to the rig;

- No more than four joints may influence any one vertex, as far as vertex weights go;

- Mesh must be parented to the rig;

- Rig must have a root bone called origin. The origin’s translation on Z should normally be zero;

- You can use the material file’s actual name as the blender material name, which will save you the need to edit the md5mesh and change the shader name manually afterwards;

 

Quick step by step:

 

After you model your mesh, uvunwrap it and apply a material to it (name it after your material in TDM); apply all transformations or modifiers.

 

Build the rig, by creating a root bone, and from that, extrude all other bones (in edit mode). Rename the root bone (as “origin”). If the model was imported, make sure you delete all existing vertex groups. Parent the mesh to the rig (ctrl+p) with automatic weights, this will create vertex groups for each bone (make sure you dont rename them afterwards, the vertex groups should be named the same as the bones). 

 

To animate it, create a new action (rename it as “idle” or something), turn on automatic keyframe, activate keying set as “whole character” (optional?). Once you have your animation ready – make sure the action is selected in the dropdown list (doesnt hurt to select all the keyframes in the action editor window as well). On 3D view, in object mode, select the armature and then the mesh. Export (with the rig, the mesh and the animation selected).

 

Place the md5mesh and md5anim files together inside the folder structure you need for your FM (example: models\md5\nature or props, etc);

 

The md5mesh needs a material file (like any ase or lwo model) and a def file. The material can either be created specifically for the md5mesh and be set inside blender (as the material name) or you can edit the mesh shader manually (by opening the file in a text editor) and refer it to an existing material – find this line in the file and place the material name inside the quotes (you will need to do that for each mesh in your model):

 

mesh {

shader "materialname"

 

The MD5 model will also need a def file, to be placed in a folder called def. The def file works like this:

 

// your model name, description and author (optional)

 

model yourmodelname

{

mesh models/md5/yourfolder/yourmodelname.md5mesh

anim idle models/md5/yourfolder/yourmodelname.md5anim

}

 

entityDef atdm:yourmodelname //will define your entity name

{

"editor_displayFolder" "Animated Props" //or any folder you want to create in DR

"spawnclass" "idAnimated"

"model" "yourmodelname"

"start_anim" "idle" //will start your anim "idle" automatically

}

 

 

This setup works for a "static" animated model, something like a bush moving with the wind, in a looped animation. The animated model, once placed inside your mission folder structure, will be available inside DR (remember to have your mission and TDM referenced in DR’s properties). To place it inside the map, you need to create it as an entity. This can be confusing, because the model (as a static model) is still available in the lists, but placing that in the map instead will result in an error and it wont show up at map start. I dont know exactly why that is. 

 

Im not 100% sure about some of the steps, any improvements or mistakes in the guide, let me know.


Edited by RPGista, 29 June 2018 - 04:04 PM.

  • Judith and Anderson like this

#15 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 157 posts

Posted 29 June 2018 - 06:01 PM

I just did a test and it seems that neither 'automatic keyframe' nor setting the 'activate keying set' is necessary. In my case I set a keyframe for the rotation (only) of a bone at frame 1, and set another keyframe/rotation at a later frame and the md5anim looked the same as it did when I initially performed the two steps you mentioned above.

 

It looks like auto keyframing is down to user choice. It stores scale and location as well as rotation, but looks like the latter two are the only things that is supported in the md5anim system.

I can't see what difference the active keying set makes, so I think that's also down to whatever the user prefers.


Edited by R Soul, 29 June 2018 - 06:08 PM.


#16 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1595 posts

Posted 29 June 2018 - 11:05 PM

Yes, you can set keyframes manually, sure. The "whole character" option will keyframe the whole skeleton everytime you do it (instead of just the bones that moved). But it is, as you say, optional.

#17 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1650 posts

Posted 30 June 2018 - 08:52 AM

A step-by-step tutorial using a specific example would be much apprieciated!





Reply to this topic



  



Also tagged with one or more of these keywords: md5, export, import, animations, modeling

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users