11
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Michael Dec 16 '11 at 7:13
7
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ 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? \$\endgroup\$ – MichaelHouse Dec 12 '11 at 15:45
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – MichaelHouse Dec 12 '11 at 22:22
  • \$\begingroup\$ 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. \$\endgroup\$ – Joshua Hedges Dec 15 '11 at 23:13
8
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ thanks a lot, but are bounding boxes also exported by that exporter \$\endgroup\$ – Martin Erhardt Sep 9 '12 at 8:59
  • \$\begingroup\$ @MartinErhardt You'll have to clarify what "that exporter" is. The .x format does not export bounding boxes. \$\endgroup\$ – MichaelHouse Sep 9 '12 at 15:38
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thanks @ccxvii, the link you provided was really useful. \$\endgroup\$ – MichaelHouse Dec 23 '11 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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