Scaling / Shear

Started by
0 comments, last by Dirk Gregorius 9 years, 10 months ago

Hi all,

Here how extract from a scaling+shear matrix in vector3 :


// Scaling part.
Scaling.x = Matrix[0][0];
Scaling.y = Matrix[1][1];
Scaling.z = Matrix[2][2];

// Shear part.
float InvD0 = 1.0f / Scaling.x;
Shear.x = Matrix[0][1] * InvD0 ;
Shear.y = Matrix[0][2] * InvD0 ;
Shear.z = Matrix[1][2] / Scaling.y;

The goal is to only have scaling vector3, is it correct to mul both like that :


FinalScaling = Scaling * Shear

Thanks for the help

Advertisement

Once you allow non-uniform scaling you can NOT decompose in SRT. You can either use polar decomposition or QR decomposition. With QR decomposition you can then decompose the Q matrix further into a scaling and shearing part. With polar decomposition this is not possible to my knowledge. You need to keep scale and shear separately and cannot combine them into one final scale.

In the engine I would recommend to allow only uniform scale, because there is always a clear decomposition. On the tool side you might allow non-uniform scale. You can always propagate the scale and shear downwards the hierarchy and bake it into a shape (mesh) if you hit one or let it go away.

This topic is closed to new replies.

Advertisement