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 have a pretty simple character rig animation. How can I export the raw data of that animation?

I'm looking for some way to export a raw text array of data that tells exactly what every joint does on every frame. This means rotation, translation, etc.

EDIT: Thanks for the answers so far. We are looking for a way to get something like this: This would be one joint of a 14 frame animation.

 <joint>
      <name> rightShoulder </name>
      <xPos>12 14 16 18 19 20 21 24 26 28 32 34 36 38 </xPos>
      <yPos>100 99 98 97 96 95 94 93 92 91 90 91 92 95 </yPos>
 </joint>

We are also trying to keep the file lightweight. So we will be ONLY including this data, no meshes, cameras or anything else. I've been looking into .DAE but it seems pretty heavy.

Any suggestions? If nothing standard works, how would one go about writing their own Maya exporter? Does something like this seem possible?

share|improve this question
    
I don't off the top of my head what the API calls are for this, but you can certainly do it using MEL or Python. I've written scripts before to export data about the position of objects. –  jhocking Jan 13 '12 at 15:37
    
Thanks guys. While the below answer is a correct one, for this particular case we ended up exporting as an .FBX file, then importing into unity. We have more experience with Unity and from there it seemed easier to simply grab the X and Y location of each joint. –  Dave Chenell Jan 17 '12 at 15:22
add comment

2 Answers 2

up vote 2 down vote accepted

I just wrote my own exporter to my own custom format by reading and messing around with stuff from Rob the Bloke's site.

I haven't actually tested exported joints yet but according to my sources and current work they are not stored in the simple XYZ like your mini format prints out. Instead each poly is given a weighted set of transforms and the transforms are what are animated. You could convert it to the format you are looking for but it is generally better to send the bone weights and transforms all to the GPU letting the shader actually transform the triangle. Vertex Blending using Shaders on GP wiki

Here is my my Maya Exporter and here is all of the source material. All my code is C++ LGPL but Maya interop code may be licensed under something else. The following link is about how far I got with skinning extraction (almost exact copy of Rob the Blokes work). MayaFile::GenerateSkinData()

You could tear it apart pretty easily away from my proprietary structure to your own or tear out only the code that actually extracts animation data. MayaFile::GetAnimatedTransforms()) It doesn't actually create my cMesh class until you call Save().

Additional Links:

MayaFile.h

MayaFile.cpp

share|improve this answer
add comment

I've found that the DirectX (.x) model format is pretty nice. It will export the mesh, armature, and animations. The animations can be exported as key frame or every frame. It's not actually the joints that are controlled but the bones. And of course bones are just a matrix transform with a list of vertices and weights.

Don't let the name fool you, this of course can be used for DirectX or OpenGL. It's fairly simple to parse these files to get animation data. The exported files are all in plain text and are easy to follow.

I found some example code for writing an importer here. And a pretty useful explanation of the format in general here, along with animation details at the bottom.

share|improve this answer
    
That's nice and all, but can you provide a Maya .x exporter? The best I've seen is cvXporter but that seems to be out-of-date chadvernon.com/blog/resources/cvxporter –  jhocking Jan 12 '12 at 20:03
    
I imagine any exporter for .x would be somewhat old, since the .x format its self is no longer supported by Microsoft. Does the exporter you mentioned not work? There are others: okino.com/conv/exp_xof.htm –  Byte56 Jan 12 '12 at 21:42
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.