Jump to content

  • Log In with Google      Sign In   
  • Create Account


Animation Retargeting


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Relfos   Members   -  Reputation: 311

Like
0Likes
Like

Posted 28 January 2014 - 02:53 PM

I am trying to code animation retargeting.

As you can see in the image below, I have 2 skeletons.

One is a human running, the other a cartoon frog.

 

My objective is to allow the frog to run using the animation from the other model.

Currently I tried detecting bones with same name in the two skeletons, and just copy bone translations&rotations from the running skeleton to the frog skeleton.

This is not enough though, the frog moves, but the animation is incorrect

 

Both skeletons have different number of bones. I would like this code to support different number of bones, since it would make porting animations from one model to another way easier.

 

Anyone has experience on this?

 

o4c6.png



Sponsor:

#2 LorenzoGatti   Crossbones+   -  Reputation: 2665

Like
0Likes
Like

Posted 30 January 2014 - 03:18 AM

Animation retargeting is a popular research field that has progressed far beyond "bones with the same name". Review scientific literature to gather a lot of good ideas to try.


Produci, consuma, crepa

#3 Steve_Segreto   Crossbones+   -  Reputation: 1514

Like
0Likes
Like

Posted 31 January 2014 - 10:40 PM

Lorenzo is right, but if you don't have the time or energy to read the latest research papers (which use a highly stylized math form), one thing you could try is affinitize the guest skeleton's bones to the host skeleton by transforming both skeletons into the same local space and then connecting guest bones to nearest neighbor skeleton bones using something like:

 

for (DWORD i = 0; i < pSkin->m_numOffsetMatrices; i++)
{
   D3DXVECTOR3 SkinPos( 0.0f, 0.0f, 0.0f );
   D3DXMATRIX boneOffsetToRoot;
   D3DXMatrixInverse( &boneOffsetToRoot, NULL, &pSkin->m_boneOffsetTransforms[ i ] );
   D3DXVec3TransformCoord( &SkinPos, &SkinPos, &boneOffsetToRoot );
   float bestDist = INFINITY;
   for (DWORD j = 0; j < pSkeleton->m_numFrames; j++)
   {
      D3DXVECTOR3 BindPos( 0.0f, 0.0f, 0.0f );
      D3DXVec3TransformCoord(
                           &BindPos,
                           &BindPos,
                           &pSkeleton->m_matrixFrames[ j ].
                           m_skeletalRootSpace );
      float dist = D3DXVec3Length( &D3DXVECTOR3( SkinPos - BindPos ) );
      if (dist < bestDist)
      {
         bestDist = dist;
         pSkin->m_boneIndex[ i ] = j;
      }
   }
}



#4 Relfos   Members   -  Reputation: 311

Like
0Likes
Like

Posted 01 February 2014 - 06:12 AM

Thanks Steve, indeed I cannot read the papers, I'm not very good at math, besides trignometry.

In my experiments I was able to almost get it working, the only problem was the bones got stretched out to the original skeleton dimensions.

I'll try your approach :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS