<p>Yes you can, provided that all the nodes' scales are only <em>uniform</em> 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.</p>

<p>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 <a href="https://computergraphics.stackexchange.com/a/4282/48">this answer</a> for how to do the decomposition).</p>

<p>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.</p>

<ol>
<li>The final scale is just the product of all the individual nodes' scales</li>
<li>The final rotation is just the composition of all the individual nodes' rotations (in quaternion form for example)</li>
<li>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 <span class="math-container">$T_1 R_1 S_1 T_2 R_2 S_2 T_3 R_3 S_3$</span> (numbering from the root down to the leaf), then the final translation is <span class="math-container">$t_1 + (R_1 S_1) t_2 + (R_1 S_1 R_2 S_2) t_3$</span>.</li>
</ol>

CC BY-SA 4.0
2018-12-26T16:56:38.533Z
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?
derekdreery
CC BY-SA 4.0
2018-12-27T01:25:10.143Z
@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](https://en.wikipedia.org/wiki/Singular_value_decomposition). This doesn't yield TRS form but rather a TRSR form: two rotations, one before and one after the scale.
Nathan Reed
CC BY-SA 4.0
2018-12-27T14:36:27.967Z
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?
derekdreery
CC BY-SA 4.0
2018-12-27T17:48:06.347Z
@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.)
Nathan Reed
CC BY-SA 4.0
2018-12-27T18:18:19.153Z
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. :)
derekdreery
CC BY-SA 4.0
2018-12-25T21:26:40.780Z
2018-12-25T21:26:40.780Z
Nathan Reed
<p>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?</p>

<transformations>
Composition of decomposed transformations
derekdreery
# Composition of decomposed transformations

(Asked by: username_0 on 2018-12-25)

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?

**Tags:** transformations


---

## 1 answers

### Answer by username_1 on 2018-12-25. Score: 2 | Accepted answer

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](https://computergraphics.stackexchange.com/a/4282/48) 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$.

> **Comments:**
> **username_0**: 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?  
> **username_1**: @username_0 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](https://en.wikipedia.org/wiki/Singular_value_decomposition). This doesn't yield TRS form but rather a TRSR form: two rotations, one before and one after the scale.  
> **username_0**: 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?  
> **username_1**: @username_0 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.)  
> **username_0**: 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. :)  

---

