Jump to content
  • Advertisement
Sign in to follow this  
pondwater

Scaling a model, should I multiply the joint matrices as well?

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

When i scale a model do the bind pose and the inverse bind pose matrices need to be scaled as well?

if so, should i multiply the whole matrix or just the translation component?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
You should be able to just apply a scale to the root joints local transform and have it propagate down through all the child joints world transform calculations. Then just use each joints world transform with the bind pose matrices as usual. Edited by NumberXaero

Share this post


Link to post
Share on other sites
Wouldn't that only affect the root joint transform? Like if the root transform is a tranlation of (2,2) and its child is a translation of (2,0), If i scale it down by 0.5, that original transform becomes (1,1), shouldn't the child transform also be scaled to (1,0)?

Wouldn't only applying it to the root produce the left image, versus what I want on the right?


Muclw.png

Maybe im thinking about this all wrong...

Share this post


Link to post
Share on other sites
As NumberXaero said, the point is to propagate the transform to all children in the hierachy - if your skeleton/animation bone matrices are all already in world space then you need to apply scaling to all joints, but if you build the bone transform chain every frame (you store joint matrices relative to parent) then it's enough to apply scaling only to the root. Edited by n3Xus

Share this post


Link to post
Share on other sites
Yeah the joint transforms are relative to the parent. So two more quick questions:

1) I'm not familiar on how to properly scale an affine transformation matrix. Do I multiply it by a uniform scaling matrix? or just multiply the whole by a scalar value? or just the translation part?

2) what do i do about the inverse bind matrix for the root. I assume it depends on how I scale the bind matrix.

Thanks again for the your responses!

Share this post


Link to post
Share on other sites
1) Multiply it by a matrix that contains just scaling:
- if you're using row major matrices the equation is: result=scaleMatrix*yourExistingMatrix
- if you're using column major its result=yourExistingMatrix*scaleMatrix
(if you are making child transformation like this: childWorld=childLocal*parent then you're using row major, if it's childWorld=parent*childLocal you're using column major, note: someone may correct me about this since I'm not 100%)

The scale matrix has the scale components on its diagonal elements, though if you're using a 4x4 matrix the bottom-right element must be 1.

2) Not sure, also try to multiply it by the scale matrix or the inverse of the scale matrix (or try changing multiplication order, it helps sometimes biggrin.png ) Edited by n3Xus

Share this post


Link to post
Share on other sites
So you have the bind pose (what I call bind shape matrix) that doesnt change and can be essentially applied to the model creating another "bind model" that can be used from here on out during skinning.
You then have a world matrix, this is the per joint world matrix that results from computing the hierarchy from the parent, you can transform the higher up joints local transforms and it will affect everything below it, this is where you would apply your scale by incorporating it into the joints local (the roots local if you want to scale everything, just concatenate a uniform scale into the the roots local transform)
Then you have the per joint inverse bind pose matrix which came out of the file data, this also doesnt change.
Apply the 3 as usual to each vertex with its weight, just make your changes to the local transforms of the joint for whatever youre trying to do, in this case scale the whole model, then apply your scales to the hieghest joint in the skeleton hierarchy, the root.

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!