• 10
• 13
• 18
• 27
• 9

Scaling / Shear

This topic is 1387 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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

Edited by Alundra

Share on other sites

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.