FBX animation problem (EvaluateGlobalTransform)

Started by
7 comments, last by maxest 12 years, 8 months ago
I'm using FBX SDK, version 2012.1. I noticed that nodes have this nice function for evalution the final transform matrix, called EvaluateGlobalTransform. It works perfectly for static meshes. I also noticed that the first parameter of this function is KTime object. So I thought I could easily get animation frames of my node this way. Unfortunately, it does not work as expected. No matter what frame I pass in, I always get the same result*. Anyone experience a similar problem?

* the animation are in the file for sure :). I checked with ImportScene samples and it writes out on output some keyframes for the nodes.
Advertisement
Okay guys... nevermind. I've just found out that function KTime::Set was for setting the internal timer, not the number of frame. The proper function was SetTime It's all working now.
FYI, there is a fast version of that method that is most definitiely worth using!
Yeah, I saw there was a function with Fast postfix, but I don't know if I need it. I want to have my own format anyway so I just want to extract all the necessary data from the FBX file and put in my own :).

Yeah, I saw there was a function with Fast postfix, but I don't know if I need it.

Trust me, you need it. The non fast method allocates the most absurd amount of memory I've ever seen. If you are have a file with a few takes in (say 12), it just grinds everything to a stand still (whilst it processes a seemingly never ending set of de-allocations). Mind you, even with the fast methods, the performance of that SDK is god awful.
Yet I still claim I don't care :). I will be using this SDK only to process each FBX file once. It's not going to be used in the "final version of a game"
Well, when you find it takes 40mins to process a single file, you can't say you weren't warned :)
40 mins?! Okay... If it starts to take too long then I'll use that Fast functions ;). So far processing a cylinder based on 4 bones is quite fast :)
Hey guys,

I've got one more problem. It's about pivots. I finally realized what GetGeometric*** actually does ;). So basically to position an object correctly in the scene I need to evaluate its global transform, and apply geometric translation/rotation/scaling. This way pivots set in 3ds max work just fine, with one exception... skinning. When I bind an object to a skin, and to modify the pivot ot that object, I get incorrectly skinned object in my application.

Here's how I compute it for non-skinned meshes:

transform = mtx::translate(newMesh.geometricTranslation) * newMesh.globalTransforms[frame];

(note that I don't use geometric rotation and scaling here, first I wanted to make sure that sole translation works ok)

And code for my skinned object:

transform.loadZeroes();

for (uint j = 0; j < newMesh.vertices.bonesReferences.size(); j++)
{
string& boneName = newMesh.vertices.bonesReferences[j].boneName;
float& boneWeight = newMesh.vertices.bonesReferences[j].boneWeight;

transform +=
boneWeight *
newMesh.transforms[boneName] *
newMesh.linkTransforms[boneName].getInversed() *
bones[boneName].globalTransforms[frame];
}

transform = mtx::translate(newMesh.geometricTranslation) * transform;

In this case it doesn't work (skin does some excessive rotation of vertices).

I also tried putting that geometricTranslation somewhere among the transform's (the variable) operands, but with no correct effect). Any idea what I'm doing wrong?

This topic is closed to new replies.

Advertisement