Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I wrote an exporter for blender models that works great for meshes. I'm attempting to extend that to bones defined in blender. However I haven't found good information for exporting bone data. How can I access bone data? I'd like access all the vertices that the bone affects, the weight of each vertex and the matrix. Do I need to export anything else for skeletal animation and dynamic dismemberment?

share|improve this question
    
I'd reply but my suggestions suck (not happy with them, and not at all transferrable), and I was hoping you'd get a good answer. I currently do the rigging in my game, and just export with a .obj, all my animation is procedural. I started off trying to read from a Collada export but it's a horrible, horrible format. Let me know if you have luck with writing the python exporter. –  Michael Dec 16 '11 at 7:13
add comment

3 Answers

up vote 6 down vote accepted

My suggestion is honestly just to find a format that Blender will export its bones as well, and then look through the script of that format exporter. I was doing something similar and realized how much of a pain it was to find a good resource on exporting bones.

But here's this specification that helped me a lot, on armature modules

share|improve this answer
    
Neat, that looks like it has some of what I need. However, it doesn't have a list of the vertices the bone encompasses or the weight of those vertices. I see that it has a bool to show that a bone uses vertexgroups, but I don't see how to access that information. It seems that Blender must be able to export that data. Anyone know how to get to it? –  Byte56 Dec 12 '11 at 15:45
2  
Looks like I may be on to something. Since Blender uses vertex groups to define the groups for bones, I can just find the vertex group with the same name as the bone, and I've found all the vertices that belong to that bone. –  Byte56 Dec 12 '11 at 22:22
    
Sounds great :]. Sorry I couldn't help further than what I did, I had a similar, but slightly different project. So I hadn't more information. –  FullyLucid Dec 15 '11 at 23:13
add comment

@Michael directed me to an excellent resource for exporting bones from Blender. It provides all the information I needed. It's actually already built into Blender, it's the DirectX Model Format.

Go to user preferences, addon section, "Import-Export" category and install "DirectX Model Format (.x)". Then use File->Export to select the newly added format.

This format exports not only the mesh information (vertices, triangles, quads, textures, etc), but also exports armature information, including the armature structure (parent/child relationships), transform matrices, which vertices are included in each bone and even the bone weights for each vertex. Animation sequences are exported too.

All in a human readable ASCII format, so it's easy to write an importer. Beautiful.

share|improve this answer
    
Thanks for this :P awesome to know. –  FullyLucid Dec 25 '11 at 3:34
    
thanks a lot, but are bounding boxes also exported by that exporter –  Martin Erhardt Sep 9 '12 at 8:59
    
@MartinErhardt You'll have to clarify what "that exporter" is. The .x format does not export bounding boxes. –  Byte56 Sep 9 '12 at 15:38
add comment

The IQM (Inter-Quake Model) format has a set of Blender exporters that will export skinned meshes with blend weights and the armature. Look to http://lee.fov120.com/iqm/ for documentation and code. You could also look at the Doom 3 format MD5 exporters.

share|improve this answer
    
Thanks @ccxvii, the link you provided was really useful. –  Byte56 Dec 23 '11 at 3:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.