Jump to content
  • Advertisement
Sign in to follow this  
BrentMorris

Animation Transformation Equivalence

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

I have a fully working skinned animation system that operates on matrices, and I'm working to get weapons and equipment parented onto bones.

 

 

Problem is, the code I'm using to batch draw static models (like for parented weapons/equipment on characters) positions the models based on translation/scaling/rotation values that are turned into matrices in the vertex shader.

 

 

I would like to do the same thing with the animation system. I want to represent each bone transformation as a position/scaling/rotation value to pass into the shader. This would allow me to use the position/scaling/rotation values from a bone directly to position the animated-model-attached models.

 

So, my question is: Is it possible to compute positions/scales/rotations for bone transformations using local bone translation/scale/rotation values instead of matrices? I don't know how to apply vec3 positions, float uniform scales, and quaternion rotations in a parent->child bone hierarchy to produce the correct results. 

 

Is this possible, or will I have to suck it up and do all of the transformations with matrices, before running some kind of matrix decomposition to get the values back out. I could also draw the bone attachment items separately using the matrices, but I would rather render everything the same way.

 

Thank you guys!

Edited by DementedCarrot

Share this post


Link to post
Share on other sites
Advertisement
derivedScale = parentScale * mScale;
derivedOrientation = parentRot * mOrientation;
derivedPosition = parentRot * (parentScale * mPosition);
derivedPosition += parentPos;
Rotations/Orientations are Quaternions, position & scales are Vector3s
 
Once you've updated the derived pos/rot/scale, you can build 4x3 matrices to pass to the vertex shader (google how to build up a 4x4 matrix from pos rot & scale, then strip the last row since it's not needed for world transformations).
Edited by Matias Goldberg

Share this post


Link to post
Share on other sites

Is it possible to do the inverse way without matrix ?

I mean, is it possible to transform a world position to local position without matrix ?

for orientation the quaternion inverse operation can be used but for scaling and position ?

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!