Importing animations from FBX files

Started by
7 comments, last by spek 10 years, 1 month ago

Is it just me, or is the FBX horribly confusing?

We need to export animations from Maya or Blender, so I tried FBX and Collada for that. Reading meshes and stuff from these file format's is not a problem, but things get really blurry when it comes to joints, keyframes, et cetera. I gave up on Collada a long time before, and tried FBX, using Autodesk's (bloated) SDK.... With success! Until now...

One of the guys used Inverse Kinematics in his animation. But since I don't know how to handle that, we looked for a way to convert IK back to FK animations. Thus having 0,1 or more keyframes per joint that describe a certain rotation or transformation.

Problem is that I don't know or have Maya, nor some other program that can import animated FBX models. But I guess the "Bake animations" option in Maya's exporter is needed. Don't know if the guy who is exporting the model did strange things, but basically I had 3 different results:

- No FK data (no "eSkeleton" nodes to be found)

- A half animated model. Some of the joints seemed ok, others didn't move at all

- A HUGE (500+ MB) file containing, well, I dunno. Lot's of keyframes or something. Couldn't process it

Apart from that, some models had a mesh, or a bindpose, others didn't. Really @#$%@ annoying that there are so much differences, and none of them worked. Now to the questions:

1- Are there particular DO's and DONT's in Maya and its exporter?

2- Does someone have experience with the FBX SDK?

Maybe I just made a stupid code bug or missed some important bits

3- Is there a free tool where I can view animated FBX files? Just to ensure the file is at least correct.

Tried "Clockstone" and Autodesks own Quicktime viewer(!), but that didn't work well.

4- Isn't there something handier than Collada / FBX?

Even if this succeeds, I'll probably never love them. But apart from Milkshape or outdated Doom MD5 files, I'm not aware of a no-nonsense format that is also supported by Blender/Maya.

Advertisement

You can have a look at this post written by me:

http://www.gamedev.net/topic/653502-useful-things-you-might-want-to-know-about-fbxsdk/

Or you can private-message me.

I think I have some of the answers you need, but not all of them

Thanks, I'll read through this after work today, and maybe drop you a letter!

I think however, that the fault is not my code part (that's easy to say). When importing it into Quicktime with their FBX viewer, I see the same problems. The animation exported with IK seems ok, but the other "converted" ones are not or only half animated. To put it more technically, some joints simply don't have a curve with translation/scale/rotation elements. Maya or its exporter skipped them for some reason. Or stored it in a very different way.

That's what I guess at least. I really have no clue how Maya looks, so it's a shot in the darkness. But the animator tried all kinds of things as well, and each time those @#% FBX files fail.

Well. I think there is an easy way to tell if FBX's Exporting process messed things up or your code has some problems.

So you have the FBXSDK, right?

Go to its samples, and open the "ViewScene" sample project.

And import your FBX file into that project and see how it is gonna be displayed. If it is still messed up, then FBX is the culprit.

I have not worked with curves; instead, I get the entire transformation at time T for my animation, which costs a lot of memory and I need to fix that. But maybe that way at least you know if you can rely on FBX format. I think FBX is solid because a lot of AAA games use it and if it has serious problems like this, no one would use it.

And if you want, can you tell me how you get the bind pose matrices?(You said sometimes you have missing bind pose matrices).

The correct way is to use "TransformLinkMatrix" function. If you use FbxPose, there is a big chance that things get messed up.


One of the guys used Inverse Kinematics in his animation. But since I don't know how to handle that, we looked for a way to convert IK back to FK animations.

This should be goal, the IK influences should be baked to the FK bones. Further on, most IK bones, bones which do not deform the mesh, should be ignored.


- No FK data (no "eSkeleton" nodes to be found)

- A half animated model. Some of the joints seemed ok, others didn't move at all

- A HUGE (500+ MB) file containing, well, I dunno. Lot's of keyframes or something. Couldn't process it

You should double check the skeleton. It should contain a clear hierachy of deform bones with a single root. Did your college use eg. "bridges", bones which do not deform your mesh and are potentially ignored therefor, but are parent to other deform bones ? He should make some simple test animations like a deforming cylinder (using IKs etc.), export this and give it to you for importing it into the game.

PS:

A good rule of thumb:

Make a layered skeleton, first layer are all deforming bones, the bones which are important for the game engine. These should define a clear hierachy including a single root bone. The second layer are control bones which are conntect to the first layer by constraints. The second layer is often the only layer which got animated by the artist, it drives the first layer. Just ensure, that the first layer contains all the (FK) transformations (bake animation before/while exporting).

It's a bit hocus-pocus since I never used Maya, but the double-layered approach sounds very logical to me. Dunno if there are bridges or multiple root bones, but I'll forward that question. But I can see there are some additional (control?) joints. Those don't have the "eSkeleton" type so I ignore them, although I still do traverse its child nodes.

@tlang1991

Good idea!

Just tried it, and, not a complete surprise, same results. So I'm pretty sure now the problems start in Maya already.


Those don't have the "eSkeleton" type so I ignore them, although I still do traverse its child nodes.

Skipping bones could be an issue, if the bones are related to its parent space.

Have you already try to use the Asset Importer Library - FBX import feature? I haven't used it now but a lot of your requested features shpuld be already supported by it. And you can use our viewer to verify your models.

See https://github.com/assimp/assimp/tree/master/code to learn more about it. And of course feel free if you have any questions regarding this topic.

- Kim

A complicate solution may indicate a not understood problem.


[twitter]KimKulling[/twitter]

Hi again,

Well, not sure if my code is 100% right indeed (so thanks for that link Kimmi!), but I modified the FBX SDK "Viewer" program a little bit so we can load a custom file. Since this viewer shows the exact same problems, I pass the ball back to the animator. First we have to got it exported right I guess. Too bad I have zero insight in Maya, so I just forwarded Ashaman's hints to the animator. Let's hope that works!

This topic is closed to new replies.

Advertisement