Blender to md5 Howto

glasz

Active Member
Contributor
Art
So i finnaly take the time to make a little blender to md5 export howto

First thing : get the exporter : http://www.katsbits.com/smforum/index.php?topic=167.0

To install in blender : Open a user preferences menu, and you can use install from file to open directly the zip file in blender :


You'll find the new addon in the import export section, just check the box :



Now you should be ready for exporting. You might need an md5 viewer to test the results. For what i know, none exist on linux, i have to use a windows one with wine. It kind of works, with a tendancy to crash, but is enough for testing exports.

Note that afaik md5 is only for rigged model, you will need a mesh attached to a skeleton. For static mesh to be use as voxels, you should use the specific terasology blender exporter.

One last thing, that is not md(-export-relevant, but usefull to know : skeletons should always, as advised by Maternal, have a root bone, of coordinates 0,0,0, that is parent to all other bones, and reamins still at 0,0,0 regardless of the animation activity. This bone will be used in code for the actual positionning of the animated model. From my test it can be added at the end if it was omited, but better to think of it from the start.

So, there is one important step to have the exporter work, it is to triangulate all faces of the mesh. By default blender mesh creates quads, so the have to be broken into triangles. Go in edit mode, select all face (with a or a-a) and Mesh->Faces->Triangulate faces :



The result is this :



Now for a step that might be optionnal : remove all vertex groups that dont belong to a skeleton bone. Vertex groups are usefull for mesh editing, but they are also used for attaching part of the mesh to a specific bone. You can do it manually, assigning a number of vertices to a vertex group with the same name as a skeleton bone will attach these vertices to that bone. It is also done automatically when you use weight painting. In both case, having vertex groups other thant the ones used by the bones will mess up the export.

Int that case the vertex group "pompom" is not used by a bone, it must be deleted :



And thats mostly it. From my experience it is better if the skeleton is in object mode for export, but i'm not sure its absolutely necessary.
One last thing is to check the scale of the export. It is possible that, like me, you didnt bother with that before, so it's the good time to rectify.

In that case the pawn is over 6 unit high, so i scale it at 0.30 to have a pawn of roughly 2 meters high in terasology :



You have the possibility to export as both mesh and anim, or only the mesh or the anim. In any case, you only export the animation that is selected in the action editor. You have, afaik, to make another export for each different animation.

Thats all i can think of for now, hope that is helpfull.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
Thanks. This will be really helpful as I try to support skeletal mesh animation using a collada format.

Now you should be ready for exporting. You might need an md5 viewer to test the results. For what i know, none exist on linux, i have to use a windows one with wine. It kind of works, with a tendancy to crash, but is enough for testing exports.
Which md5 viewer are you using in wine under linux?

One last thing, that is not md(-export-relevant, but usefull to know : skeletons should always, as advised by Maternal, have a root bone, of coordinates 0,0,0, that is parent to all other bones, and reamins still at 0,0,0 regardless of the animation activity. This bone will be used in code for the actual positionning of the animated model. From my test it can be added at the end if it was omited, but better to think of it from the start.
Yes, our current skeletal mesh loader only allows one root bone. I don't know if it matters if it remains at 0,0,0, though. Someone else will have to comment on that aspect.

One last thing is to check the scale of the export. It is possible that, like me, you didnt bother with that before, so it's the good time to rectify.

In that case the pawn is over 6 unit high, so i scale it at 0.30 to have a pawn of roughly 2 meters high in terasology :
Yes, the terasology scale is 1 unit = 1 meter for anyone wondering what scale to use.
 

glasz

Active Member
Contributor
Art
So, _flo noticed the bouding box where wrong with that exporter, and it needed to be fixed, wich i think i did. Here's the fixed script, with a test deer md5 made with that version of the exporter :
 

Attachments

Frank Diem

New Member
Hi, what version of blender did you use to make the sample in the fix (the deer)?
I'm doing this project and I got some issues with this version of the script: io_export_md5-263... so I'll be using yours
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
I haven't seen @glasz on IRC for a few days. Maybe he's on vacation or something?

@Florian do you have any idea?

And hello @Frank Diem ! It would be good to have some more creatures, what do you have in mind working on? :)
 

Nihal Singh

Member
Contributor
World
Hunter
@glasz I'm having trouble running the exporter. Tried using it with the deer and it worked. But with the cow, it gives an error-



With the duck it gives this-


I'm new to blender, so I don't know what that means.
 
Last edited:

Nihal Singh

Member
Contributor
World
Hunter
Update-I tried converting the bird's blend file and it worked. The size however was quite large so I tried scaling it down to a tenth. This however resulted in some weird behavior:
Without scaling it looked like this-



With scaling it to 1/10 it looks like this-





It appears as if there is something protruding out of them reaching to a specific coordinate (centre?).

Would love some help here :)
 

glasz

Active Member
Contributor
Art
For the error messages : First case it seems the model is not attached to an armature. Second it seems it has no texture, or is not uvmapped. For the bird it seems one vertex is not properly attached to the armature and sticks out. Either one vertex has been missed while attaching the model to a skeleton, or there are extra vertex groups in the model that are not used by the skeleton.
 

Nihal Singh

Member
Contributor
World
Hunter
@glasz I tried adding a UV Layer to a chick (which didn't have one already) and was able to do so by simply going into Edit mode selecting the icosphere and hitting 'U' -> 'Unwrap'
Don't know if it was the right way to do it but the chicks do appear in game, half submerged and with weird movement.


In the case of the duck however there were several objects to which I could add a UV Map, and using the same method as above did not work.

I still don't understand how to do add an armature modifier. I tried adding one to the cow, but it said modifier is disabled, skipping apply. Could you link me to a relevant tutorial or elaborate a little more on the steps. :)
 

glasz

Active Member
Contributor
Art
Well, basically the md5 format is for animated models, and will only work with a model that not only has a skeleton, but has at least one animation. What we call armature is the skeleton that the mesh is attached to, that is used to animate it.

Here's a tutorial explaining the basics :

Another one a little more complete
 
Last edited:
Top