Advertisement Jump to content
Sign in to follow this  
Adaline

Question about bone transformations

This topic is 1825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello

I'm implementing skeletal animations with Assimp for DX10 following this tutorial :http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html

 

For now, I can display the skinned mesh in global pose, filling the matrix palette with identities.

 

I don't understand the bone transformation explained in this tutorial, that is:

offsetMatrix*scale*rotation*translation*inverseRootNodeTransform

I think it should be :

offsetMatrix*scale*rotation*translation*inverseOffsetMatrix

1) offsetMatrix : to get from model space to bone space

2) scale*rotation*translation : transformation in bone space, get by interpoling animation keys,

3) inverseOffsetMatrix : to get back in model space.

 

Which one do you think is correct, please?

 

Thanks

 

[EDITED]

I tried both, and get incorrect results (abstract art instead of a ... duck sad.png )

 

Animation keys interpolation seems to work, but I wrongly compute the bone transformations apparently.

I suppose I don't understand correctly the aim of the offset matrix ... 

 

[EDITED2] fixed !

 

in fact the transformation for a node is :

scale*rotation*translation*parent

and is for a bone :

offset*scale*rotation*translation*parent*inverseRoot

[EDIT3]

In this tutorial it has been said :

 

 

If the node does not correspond to a bone then that is its final transformation. If it does we overwrite it with a matrix that we generate.

 

Actually it's not totally true, if an animation channel is associated to a node, we must also overrite the transform with animated one, even if it is not associated to a bone.

(Anyway, it would be odd that some animations channels would be defined for nothing ....)

Edited by Tournicoti

Share this post


Link to post
Share on other sites
Advertisement

Hi,

 

I'm implementing the same skeletal animations with Assimp for DX11 but my is result is bad...

And i need some help...

 

Here is my ReadNodeHeirarchy:

 

 

void Mesh::ReadNodeHeirarchy(float AnimationTime, const aiNode* pNode, XMMATRIX ParentTransform)

{    
    String NodeName(pNode->mName.data);
    
    const aiAnimation* pAnimation = m_pScene->mAnimations[0];
        
aiMatrix4x4 mat = pNode->mTransformation;
XMMATRIX NodeTransformation = TOXMMATRIX(mat);
     
    const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnimation, NodeName);
    
    if (pNodeAnim) {
        // Interpolate scaling and generate scaling transformation matrix
        aiVector3D Scaling;
        CalcInterpolatedScaling(Scaling, AnimationTime, pNodeAnim);
        XMMATRIX ScalingM =XMMatrixScaling(Scaling.x, Scaling.y, Scaling.z);
        
        
        // Interpolate rotation and generate rotation transformation matrix
        aiQuaternion RotationQ;
        CalcInterpolatedRotation(RotationQ, AnimationTime, pNodeAnim);        
 
XMVECTOR axis = XMVectorSet(RotationQ.x,RotationQ.y,RotationQ.z,1);
XMMATRIX RotationM = XMMatrixRotationQuaternion(XMQuaternionRotationAxis(axis,RotationQ.w));
//RotationM = XMMatrixTranspose(RotationM);
 
 
        // Interpolate translation and generate translation transformation matrix
        aiVector3D Translation;
        CalcInterpolatedPosition(Translation, AnimationTime, pNodeAnim);
XMMATRIX TranslationM = XMMatrixTranslation(Translation.x, Translation.y, Translation.z);
        
        // Combine the above transformations
        NodeTransformation = ScalingM *  RotationM * TranslationM ;
 
    }
       
 
 
XMMATRIX nodeTrans =  NodeTransformation * ParentTransform;
    
    if (m_BoneMapping.find(NodeName) != m_BoneMapping.end()) {
        unsigned int BoneIndex = m_BoneMapping[NodeName];
        m_BoneInfo[BoneIndex].FinalTransformation =  m_BoneInfo[BoneIndex].BoneOffset * nodeTrans * m_GlobalInverseTransform ;
 
// m_GlobalInverseTransform *  *  GlobalTransformation      ;
    }
    
    for (unsigned int i = 0 ; i < pNode->mNumChildren ; i++) {
ReadNodeHeirarchy(AnimationTime, pNode->mChildren, nodeTrans);
    }
}
 
 
 
Can you help me ?
 
Thanks,
 
Fabrice

Share this post


Link to post
Share on other sites

Hello

 

I've implemented skeletal animations in two phases : GPU side and CPU side.

 

1)I coded the shaders that do skinning, and checked them via offset matrices set to identity, to check if I display in this case the bind pose correctly.

 

2)Then I coded the animation controller, I had some difficulties at the begining but finally I get it work with the transformations I give for bones or for nodes in the first post.

 

Did you check the first point ? Do you get the bind pose with identity offset matrices ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!