c++animationsdkfbx

Need some assistance in understanding FBX SDK data structures


I am attempting to convert the animation of some older files over to the FBX file format in order to import them into the Unreal engine. I am currently going through the data structures and see how what I have can relate to the FBX data structures. I have a few questions that I am asking the community to help me in my understanding:

  1. Am I able to create the animation separately? As in, do I have to attach a skeleton within the FBX file format? I am asking because Yes, I do have a skeleton for the animation but I would like to be able to extract these separately. Unreal is able to handle combining them both within the program but is it theoretically possible to export the skeleton then the animation? Or do I have to have the skeleton in the animation export in order for the FBX file format to work properly?

  2. With that being said, the old animation file does have references to bones. And by reference to bones, I only have the name of the bone that is belongs to. There is no id, just a string of the name. Which is fine. So when I go to build the FBX for the animation, I will create a scene that holds all of the data. Now for the stack and the layer, should I give each bone name it's own stack? Or should I have only 1 stack and underneath that give each bone name it's own layer?

Note: this is only for 1 object. Each scene will only have 1 object that I am animating. There will never be more then 1 object.


Solution

  • Do I have to attach a skeleton within the FBX file format?

    FBX uses FbxAnimCurveNodes to link FbxAnimCurves to animatable FbxObject properties (such as translation and rotation). Therefore, if you omit the skeleton from the file, then FbxAnimCurveNodes theoretically become useless, and all you're left with are generic FbxAnimCurves.

    An FbxAnimCurve by itself doesn't really have much significance. You could think of it like a traditional math function f(n). Is f(n) driving translation along the X-axis or is it driving rotation about the Y-axis? There is no embedded information telling what is actually changing with time. (That is the role of FbxAnimCurveNode.)

    That all being said, you might be able to get away with naming each curve. For example, "left_wrist_position_x" or "hip_rotation_z". (This approach might not work with programs such as Maya though.)

    Now for the stack and the layer, should I give each bone name it's own stack? Or should I have only 1 stack and underneath that give each bone name it's own layer?

    To answer this question: you wouldn't really do either. Bones are defined as FbxNodes with an FbxSkeleton attribute attached.

    You can think of the FbxAnimStack as a collection of animation sequences for a single character. You can then think of FbxAnimLayer as the different sequences for the character such a standing, walking, and running. Each FbxAnimLayer holds a collection of FbxAnimCurves, which are linked to properties such as object translation, rotation, or even changing material color - using FbxAnimCurveNodes.

    The FBX SDK also allows you to blend between layers - for example, blending from a walking cycle into a running cycle.

    Hope that helps a bit!

    Autodesk goes a little more in depth about these types here