Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am experiencing difficulties trying to figure out the correct multiplication order for a final transform matrix. I always get either strange movement or distorted geometry. My current model is explained below:

For a single node my multiplication order is:

L = S * R * T


L = local transformation matrix

S = local scale matrix

R = local rotation matrix

T = local translate matrix

For a node's world transformation:

W = P.W * L


W = world transformation matrix

P.W = parent world transformation matrix

L = the local transformation matrix calculated above

When rendering, for each node I calculate the matrix :

MV = Inv(C) * N.W


MV = the model view transformation matrix for a particular node

Inv(C) = the inverse camera transformation matrix

N.W = the node's world transformation matrix calculated above.

Finally, in the shader I have the fallowing transformation:



TVP = final transformed vertex position

PRP = perspective matrix

MV = the node's world transformation matrix calculated above

VP = untransformed vertex position.

With the current model, child nodes which have local rotation, rotate strangely when transforming the camera. Where did I go wrong with the multiplication order?

share|improve this question
up vote 21 down vote accepted

Any combination of the order S*R*T gives a valid transformation matrix. However, it is pretty common to first scale the object, then rotate it, then translate it:

L = T * R * S

If you do not do it in that order, then a non-uniform scaling will be affected by the previous rotation, making your object look skewed. And the rotation will be affected by the translation, making the final position of your object very different from what the value of the translation would make you expect.

share|improve this answer
Can you explain this a bit more? From what I am used to, the rotation can not be affected by a translation since it is a difference in orientation between two frames, independent of position. Instead, a translation can be affected by a rotation that happens before it, since it will translate on the newly defined axis of rotation. In L=TRS, the translation happens first, so it is not affected by the new vectors created by the rotation. – user1938107 Jun 15 '15 at 9:53
The confusion comes from the fact that you are talking about local transformations (where the frame remains linked to the object), whereas the transformations described here happen in world space (where there is only one fixed reference frame, the world). Conceptually, your way of seeing things is valid, and it is equivalent to applying transformations in reverse order. – sam hocevar Jun 15 '15 at 15:29
Ah, thank you for clearing it up. – user1938107 Jun 15 '15 at 23:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.