Blender to md5 Howto

Discussion in 'Art & Media' started by glasz, Apr 8, 2014.

  1. glasz

    glasz Active Member Staff Member

    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 :
    [​IMG]

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

    [​IMG]

    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 :

    [​IMG]

    The result is this :

    [​IMG]

    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 :

    [​IMG]

    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 :

    [​IMG]

    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.
    • Winner Winner x 3
    • Useful Useful x 2
  2. Mike Kienenberger

    Mike Kienenberger Active Member

    Thanks. This will be really helpful as I try to support skeletal mesh animation using a collada format.

    Which md5 viewer are you using in wine under linux?

    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.

    Yes, the terasology scale is 1 unit = 1 meter for anyone wondering what scale to use.
  3. glasz

    glasz Active Member Staff Member

    Mike Kienenberger : i cant remember where i found my viewer, the file is just named modelviewer.exe, wich doesnt help.
  4. glasz

    glasz Active Member Staff Member

    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 :

    Attached Files:

    • Like Like x 2
  5. Florian

    Florian Active Member

  6. Frank Diem

    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
  7. Florian

    Florian Active Member

    @Frank Diem I haven't tried the new verstion yet. Maybe @glasz can tell you which version he used to test the fix.
  8. Cervator

    Cervator Project Lead and Community Wizard Staff Member

    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? :)
  9. glasz

    glasz Active Member Staff Member

    I probably used blender 171, the one i'm still using..
    • Like Like x 1
  10. glasz

    glasz Active Member Staff Member

  11. Nihal Singh

    Nihal Singh New Member

    @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-

    [​IMG]

    With the duck it gives this-

    [​IMG]
    I'm new to blender, so I don't know what that means.
    [​IMG]
    Last edited: Mar 16, 2017
  12. Nihal Singh

    Nihal Singh New Member

    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-

    [​IMG]

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

    [​IMG]

    [​IMG]

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

    Would love some help here :)
  13. glasz

    glasz Active Member Staff Member

    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.
  14. Nihal Singh

    Nihal Singh New Member

    @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.
    [​IMG]

    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. :)
  15. glasz

    glasz Active Member Staff Member

    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
    • Like Like x 1
    Last edited: Mar 17, 2017 at 4:51 AM

Share This Page