Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interpolation between two animations of one FBX file

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
418 Views, 3 Replies

Interpolation between two animations of one FBX file

Suppose there are two animations in an fbx file.

When interpolation animation's node RST in switching from anim1 at time 1.0 to anim2 at time 1.0.

I found some node's didn't have RST transforms,so is there a way to get missing RST?

 

3 REPLIES 3
Message 2 of 4
regalir
in reply to: Anonymous

Hi,

I am sorry but I don't understand the question.

When you talk about 2 animations, do you mean two AnimStack? Two separate Layer?

And RST; do you mean Rotation, Scaling and Translation values?

 

What is your current workflow? Do you use the Evaluate functions or just trying to access animation keys?

Message 3 of 4
Anonymous
in reply to: regalir

Hi,

Sorry for the problem is not clearly described.

2 animations means two AnimStack and each stack contains one AnimLayer.

RST means Rotation, Scaling and Translation values which I get from AnimCurve.

Stack1 have 6 AnimCurveNodes which is head\neck\hip\arm\leg\foot and all have transforms key frames

Stack2 have 6 nodes too but hip have no transforms key frams.

When I interpolate from stack1 to stack2,I use indentity matrix as stack2's hip RST,but the result is not right.

So is there a way to get the missing RST or I have to modify FBX file?

Message 4 of 4
regalir
in reply to: Anonymous

I don't know all the details of your implementation but you are probably checking if you have an FbxAnimCurve and/or FbxAnimCurveNode on the property you are processing. If you don't have these objects then you have to directly access the FbxNode::Lcl properties and get the values from there.

 

However, have you considered using one of the Evaluate fonctions on the FbxNode? The Evaluation will take care of looking at the animation curves (if present), curve node and local properties on the node. The follow snipped may give you some idea

 

FbxAnimStack* firstStack = lScene->GetSrcObject<FbxAnimStack>(0);
FbxAnimStack* secondStack = nullptr;
for (int i = 1; i < lScene->GetSrcObjectCount<FbxAnimStack>(); i++)
{
    secondStack = lScene->GetSrcObject<FbxAnimStack>(i);
}

if (firstStack && secondStack)
{            
    // This part can certainly be better coded by walking the scene graph
    FbxNode* lNode1 = lScene->FindNodeByName("Skeleton root");
    FbxNode* lNode2 = lScene->FindNodeByName("Skeleton node");
    FbxNode* lNode3 = lScene->FindNodeByName("Skeleton node 1");

    for (int i = 0; i < 2; i++)
    {
        FbxTime time; // time can be incremented by any value so you can also
        // evaluate inbetween frames (if desired). Else, you can parse the animcurves and get the time
        // from the keys
        time.SetSecondDouble(5.0 * i);

        // Set the current stack to 'firstStack'
        lScene->SetCurrentAnimationStack(firstStack);

        // Get the local transform matrix (you can also get the global one)
        // The advantage of using the Evaluate function is that all the layers in the stack are being
        // taken into consideration based on their blend/mute modes as well as all the other 
        // transformation stuff such as Pivots.
        FbxAMatrix lNode1Mat1 = lNode1->EvaluateLocalTransform(time);
        FbxAMatrix lNode2Mat1 = lNode2->EvaluateLocalTransform(time);
        FbxAMatrix lNode3Mat1 = lNode3->EvaluateLocalTransform(time);

        // now switch the stack to 'secondStack'
        lScene->SetCurrentAnimationStack(secondStack);

        // and get the local transform matrix from the same nodes and the same time
        FbxAMatrix lNode1Mat2 = lNode1->EvaluateLocalTransform(time);
        FbxAMatrix lNode2Mat2 = lNode2->EvaluateLocalTransform(time);
        FbxAMatrix lNode3Mat2 = lNode3->EvaluateLocalTransform(time);
    }
}

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report