• Create Account

### #ActualTheChubu

Posted 05 January 2013 - 02:31 PM

And i'm not sure, but i think the order in which you transform the matrices matters,for example translating the matrix and then rotating it is not the same as doing it the other way around.

This. Matrix don't work like conventional numbers, their multiplication is not commutative. ie, For matrix A and matrix B, A*B =/= B*A.

I think you had to reverse the order to get things working. ie, I have a vertex, a perspective matrix and a rotation. I want to rotate the vertex and then use the perspective projection on it, thus the order would be:

perspective * rotation * vertex

Scaling comes before a rotation otherwise you'd scale along the wrong axis (ie, deform your model), so in the multiplication you reverse it by putting it after the rotation.

Thus you'd have: perspective * rotation * scaling * vertex.

### #1TheChubu

Posted 05 January 2013 - 02:30 PM

And i'm not sure, but i think the order in which you transform the matrices matters,for example translating the matrix and then rotating it is not the same as doing it the other way around.

This. Matrix don't work like conventional numbers, their multiplication is not commutative. ie, For matrix A and matrix B, A*B =/= B*A.

I think you had to reverse the order to get things working. ie, I have a vertex, a perspective matrix and a rotation. I want to rotate the vertex and then use the perspective projection on it, thus the order would be:

perspective * rotation * vertex

Scaling comes before a rotation otherwise you'd scale along the wrong axis (ie, deform your model).

Thus you'd have: perspective * rotation * scaling * vertex.

PARTNERS