Sign in to follow this  
maxest

FBX animation problem (EvaluateGlobalTransform)

Recommended Posts

maxest    622
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.

Share this post


Link to post
Share on other sites
maxest    622
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.

Share this post


Link to post
Share on other sites
maxest    622
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 :).

Share this post


Link to post
Share on other sites
RobTheBloke    2553
[quote name='maxest' timestamp='1313149126' post='4848171']
Yeah, I saw there was a function with Fast postfix, but I don't know if I need it.
[/quote]
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.

Share this post


Link to post
Share on other sites
maxest    622
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:
[code]
transform = mtx::translate(newMesh.geometricTranslation) * newMesh.globalTransforms[frame];
[/code]
(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:
[code]
transform.loadZeroes();

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

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

transform = mtx::translate(newMesh.geometricTranslation) * transform;
[/code]
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this