Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Skinned Mesh Origrinal Matrix

This topic is 4406 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

Is there a way to get the original TransformationMatrix of the skinned mesh after a unknown period of animation? This is because, as my mesh instance shares the same resources, if one of the instance is not animating, but another is animated, it will cause all instance to move as the transformation matrix is shared across all instance. Is there a way to solve this problem? E.g MeshOne is not animated, MeshTwo is being animated each frame. However as the mesh shares the same resources since they are instances, MeshOne gets animated since it get the same resource from MeshTwo.

Share this post


Link to post
Share on other sites
Advertisement
You can have one mesh, but you will initially only have one animation controller and one D3DXFRAME hierarchy. You would need to create a new animation controller for each instance of the mesh to animate. You can get this by just cloning the current one to a new one. Then each one could have its own animation track(s) active at a time and its own events and such.

However, each controller would still be pointing to that one D3DXFRAME.

For each instance of the mesh:
{
1) Call that instance's AnimationController->AdvanceTime() function to set the TransformationMatrix's in the D3DXFRAME hierarcy.

2) Call your function to recurse through the D3DXFRAME and calculate the to-root-matrix for each frame.

3) Build the final array of matrices that are to be passed to your shader (offset * to-root)
}

So, each instance would also need its own array of matrices for the shader too.

Then you can do the drawing calls, sending those matrix array for each instance to the shader and pMesh->DrawSubset(0).

You could create a class for each instance that has its own animationController and final matrix array and loop through them to do the animation and draw them. You would also need some logic to move the mesh around the world and create the world matrix for that instance.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!