Say I have a scene graph, and each node has a scale, rotation, and translation. Can I combine these into a single scale, rotation, and translation?


1 Answer 1


Yes you can, provided that all the nodes' scales are only uniform scaling—the same scaling factor along all three axes. If there is nonuniform scaling (different factors along different axes) then things get more complicated, and the composed transformation generally can't be decomposed cleanly into scale, rotation, and translation.

One way to accomplish this is to convert all the individual nodes' transforms into 4×4 matrix form, multiply the matrices down the tree from root to leaf, then decompose the resulting matrix (see this answer for how to do the decomposition).

However, if you have all the transforms in TRS form (translate, rotate, scale—assuming column vector convention) and you want the final transform in TRS form, you can also combine them directly.

  1. The final scale is just the product of all the individual nodes' scales
  2. The final rotation is just the composition of all the individual nodes' rotations (in quaternion form for example)
  3. The final translation is made by summing the translation vectors, but transforming each vector by the composite scale and rotation of all the nodes above it in the tree. For example if you have a transformation $T_1 R_1 S_1 T_2 R_2 S_2 T_3 R_3 S_3$ (numbering from the root down to the leaf), then the final translation is $t_1 + (R_1 S_1) t_2 + (R_1 S_1 R_2 S_2) t_3$.
  • $\begingroup$ Thanks for a great answer. Instinctively you will still be ok if any non-uniform scaling happens before any rotation, is this the case? Do you know how general you can go with this? $\endgroup$ Commented Dec 26, 2018 at 16:56
  • $\begingroup$ @derekdreery Yep, that's right, as long as all non-uniform scaling happens before any rotation, you can still put it in TRS form. In the general case, with no restrictions on non-uniform scaling, you can apply singular value decomposition. This doesn't yield TRS form but rather a TRSR form: two rotations, one before and one after the scale. $\endgroup$ Commented Dec 27, 2018 at 1:25
  • $\begingroup$ Ooh so that is a geometric understanding of SVD. TIL! Will the SVD reduce to the TRS form in the case that a TRS is possible? $\endgroup$ Commented Dec 27, 2018 at 14:36
  • 1
    $\begingroup$ @derekdreery I think so, yes, but I haven't tried it. (BTW, just to be clear: I'm talking about doing SVD on just the 3×3 submatrix, which gives you the RSR part of the decomposition; the translation part is read off from the fourth column like usual.) $\endgroup$ Commented Dec 27, 2018 at 17:48
  • $\begingroup$ Yep that was my understanding. Because the bottom row is (0, 0, 0, 1), the translation neatly decomposes from the other parts of the transformation. So when I say TRS, read RS. :) $\endgroup$ Commented Dec 27, 2018 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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