Is simple matrix decompose normalizing 3x3 part safe?

Recommended Posts

Hi all,
The easy way to decompose an affine transformation matrix is to:

1) Compute the length of the column (or row), that gives the scale on X, Y and Z.
2) Extract the last column (or row) to have the translation on X, Y and Z.
3) Last part is to normalize the 3x3 and create the quaternion from it.

Is it safe in all cases for an affine transformation matrix?
Thanks!

Share on other sites

What form are you decomposing it into? A scale vector, quaternion for orientation, and a translation vector?

Share on other sites

I use polar decomposition. It decomposes a 3x3 matrix into a rotational and 'stretch' matrix. This is a good resource on this topic:

Say you transform a vertex by a hierarchy of rotations and scale. E.g.

v' = R2 * S2 * ( R1 * S1 * v )

v' = R2 * ( R1 * R1^T  )* S2 * ( R1 * S1 * v )

v' = ( R2 * R1 ) * ( R1^T  * S2 * R1 * S1 ) * v

v' = R * S

R * S is obviously a valid decomposition,  but the scaling factor is not a pure 'stretch' as it still contains rotation. This can lead to interpolation artifacts. If you just want to bake the scaling part into some geometry this will be fine. So what kind of decomposition you choose depends a bit on what you are trying to do.

Share on other sites

I only use decomposition for FBX node transform and when you pass a matrix in the transformation class which then decompose to: Position, Rotation and Scale.
There is 3 way I'm aware of to achieve that: Simple decompose like I said, QR decompostion (gram-schmidt or house holder) and polar decomposition.
I first used Polar Decomposition but then switched to QR decomposition since rotation scaling is always identity from FBX.
My concern was to know if the simple decomposition has problem and when.

Share on other sites
Posted (edited)

The simple decomposition has problems if you use non-uniform scale in non-leaf nodes as this will introduce shear. I think the FBX documentation even states this as a problem. Practically I would not worry about this very much. Personally I use the built-in decomposition of the FBXAMatrix and never had problems.

Edited by Dirk Gregorius

Share on other sites

For extracting the rotational part of a 3x3 matrix I use a quaternion based decomposition then convert the result back to a matrix:

http://matthias-mueller-fischer.ch/publications/stablePolarDecomp.pdf

This method solves a couple of simulation problems and it is extremelly easy to implement.

Create an account

Register a new account

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 9
• 11
• 15
• 21
• 26