3D Composite Transformations

3D composite transformations extend the same core idea from 2D combining translation, rotation, and scaling into a single matrix but with added complexity, since rotation in 3D requires specifying an axis, and there are now three independent coordinate axes to manage instead of one rotation plane.

What is a 3D Composite Transformation?

A 3D composite transformation is built by applying a sequence of basic 3D transformations translation, rotation, scaling to an object, one after another. 

Since each is represented as a 4×4 matrix in homogeneous coordinates, the entire sequence can be combined into a single resultant matrix through matrix multiplication, then applied to every vertex of the object in one step.

If T1, T2, T3, ... are individual 4×4 transformation matrices applied in that order:

M = Tn · ... · T3 · T2 · T1

And the transformed point is:

P' = M · P

Why Composite Transformations are Essential in 3D?

  1. Efficiency: For a 3D model with thousands of vertices, computing one combined 4×4 matrix once rather than applying each transformation separately to every vertex saves enormous amounts of computation.
  2. Pivot-based operations require composition: Just as in 2D, operations like scaling about a custom point or rotating about an axis that doesn't align with X, Y, or Z cannot be done using a single basic matrix; they require composing translation with rotation/scaling.
  3. Rotation about an arbitrary axis is itself inherently composite: This is the key new feature in 3D (with no equivalent complexity in 2D) rotating about a general axis in space requires a multi-step composite transformation, covered below.
  4. Object placement in a 3D scene: Every object placed in a 3D scene (a character, a prop, a camera) typically needs to be scaled, oriented, and positioned all combined into a single Model Matrix.

Order of Transformations Matters Even More in 3D

Matrix multiplication remains non-commutative in 3D:

T1 · T2 ≠ T2 · T1

But in 3D this matters even more critically for rotations: rotations about different axes do not commute with each other, unlike in 2D where there's only one rotation plane.

Rx(θ) · Ry(φ) ≠ Ry(φ) · Rx(θ)

This is the root cause of phenomena like gimbal lock, where chaining rotations about fixed axes in a specific order can cause two rotational axes to become aligned, losing a degree of freedom. 

Careful ordering (and sometimes alternative representations like quaternions) is used to manage this in advanced applications.

Reading Order

For P' = T3 · T2 · T1 · P, transformations apply right to left: T1 first, then T2, then T3.


Standard 3D Composite Transformation Scenarios

1. Scaling about an Arbitrary Fixed Point

To scale by (sx, sy, sz) about a fixed point F(px, py, pz):

M = T(px, py, pz) · S(sx, sy, sz) · T(-px, -py, -pz)

Expanded combined matrix:

M = | sx   0    0    px(1-sx) |
    | 0    sy   0    py(1-sy) |
    | 0    0    sz   pz(1-sz) |
    | 0    0    0        1    |

2. Rotation about an Axis Parallel to a Coordinate Axis

If the rotation axis is parallel to, say, the Z-axis but offset from the origin (passing through point (px, py, 0) in direction parallel to Z):

M = T(px, py, 0) · Rz(θ) · T(-px, -py, 0)

This is the direct 3D analog of 2D rotation about an arbitrary pivot.

3. Rotation about a Truly Arbitrary Axis (General Case)

This is the most involved composite scenario unique to 3D. Given an axis defined by a point and a direction vector, the steps are:

  1. Translate the axis so it passes through the origin: T(-px, -py, -pz)
  2. Rotate about X (and/or Y) to align the axis with the Z-axis: Rx(α), Ry(β)
  3. Rotate by the desired angle θ about Z: Rz(θ)
  4. Undo the alignment rotations: Ry(-β), Rx(-α)
  5. Translate back: T(px, py, pz)

Combined:

M = T · Rx(-α) · Ry(-β) · Rz(θ) · Ry(β) · Rx(α) · T^-1

Alternatively, Rodrigues' Rotation Formula computes this directly for a unit axis vector n = (nx, ny, nz) without the multi-step alignment process:

R = I + sinθ·K + (1-cosθ)·K²,   where K = |  0   -nz   ny |
                                          |  nz   0   -nx |
                                          | -ny   nx   0  |

4. General 3D Object Placement (Scale → Rotate → Translate)

The standard Model Matrix used to place an object in a 3D scene:

M = T · R · S

Order (right to left): Scale about local origin → Rotate about local origin → Translate to final world position.


Properties of 3D Composite Transformations

  1. Associativity:

    (T3 · T2) · T1 = T3 · (T2 · T1)

    The combined matrix can be precomputed once and reused for all vertices.

  2. Non-commutativity (general case): Different transformation types and even rotations about different axes generally do not commute.
  3. Special-case commutativity:
    • Translations always commute with each other.
    • Rotations about the same axis commute (Rz(θ1)·Rz(θ2) = Rz(θ1+θ2)).
    • Scalings about the same fixed point commute.
    • Uniform scaling commutes with rotation about the same center.
  4. Inverse of a composite:

    (T3 · T2 · T1)^-1 = T1^-1 · T2^-1 · T3^-1

    For rotation matrices specifically, R^-1 = R^T, which simplifies computing inverses in practice.

  5. Determinant:

    det(M) = det(T3) · det(T2) · det(T1)

    A pure rotation contributes determinant +1; a reflection or negative scale factor contributes -1; this lets you quickly check whether a composite 3D transform flips handedness.


Solved Numerical Problems

Problem 1

A point P(2, 1, 3) is scaled by factors (2, 2, 2) about the origin, then translated by (1, 0, 4). Find the final position using M = T · S.

Solution:

Scale: (2×2, 1×2, 3×2) = (4, 2, 6)
Translate: (4+1, 2+0, 6+4) = (5, 2, 10)

Final point P' = (5, 2, 10)

Problem 2

Scale the point P(6, 8, 4) by factors (0.5, 0.5, 0.5) about the fixed point F(2, 2, 2), using M = T(2,2,2) · S(0.5,0.5,0.5) · T(-2,-2,-2).

Solution:

Step 1 (translate to origin): (6-2, 8-2, 4-2) = (4, 6, 2)
Step 2 (scale): (4×0.5, 6×0.5, 2×0.5) = (2, 3, 1)
Step 3 (translate back): (2+2, 3+2, 1+2) = (4, 5, 3)

Final point P' = (4, 5, 3)

Verification using direct formula x' = sx(x-px)+px:

x' = 0.5(6-2)+2 = 4, y' = 0.5(8-2)+2 = 5, z' = 0.5(4-2)+2 = 3 ✓ Matches.

Problem 3

A point P(1, 0, 0) is transformed using M = Rz(90°) · Ry(90°) rotated first by 90° about Y, then by 90° about Z. Compare with applying the rotations in the reverse order.

Solution:

Ry(90°) first, then Rz(90°):

Ry(90°) on (1,0,0): z'=z(0)-x(1)=-1, x'=z(1)+x(0)=0, y'=0 → (0, 0, -1)
Rz(90°) on (0,0,-1): x'=0(0)-0(1)=0, y'=0(1)+0(0)=0, z'=-1 → (0, 0, -1)

Rz(90°) first, then Ry(90°):

Rz(90°) on (1,0,0): x'=1(0)-0(1)=0, y'=1(1)+0(0)=1, z'=0 → (0, 1, 0)
Ry(90°) on (0,1,0): z'=0(0)-0(1)=0, x'=0(1)+0(0)=0, y'=1 → (0, 1, 0)

Result: (0,0,-1) vs (0,1,0) confirming that 3D rotations about different axes do not commute, reinforcing why composite order is critical in 3D.

Problem 4

Find the inverse of M = T(3,2,1) · Rz(90°), and use it to recover the original point if the transformed point is P'(5, 6, 4).

Solution:

M^-1 = Rz(-90°) · T(-3,-2,-1)

Translate by (-3,-2,-1): (5-3, 6-2, 4-1) = (2, 4, 3)
Rotate by -90° about Z (cos=0, sin=-1):
  x' = 2(0) - 4(-1) = 4
  y' = 2(-1) + 4(0) = -2
  z' = 3

Recovered point P = (4, -2, 3)

Verification: Apply M to (4,-2,3): rotate Rz(90°) gives x'=4(0)-(-2)(1)=2, y'=4(1)+(-2)(0)=4, z'=3 → (2,4,3); translate (3,2,1) gives (5,6,4) Matches.

Problem 5

A cube vertex at A(1, 1, 1) is transformed using M = T(2,0,0) · Rz(90°) · S(2,2,2) — first scaled, then rotated about Z, then translated. Find the final position.

Solution:

Scale (2,2,2): (1×2, 1×2, 1×2) = (2, 2, 2)
Rotate Rz(90°) (cos=0, sin=1): x'=2(0)-2(1)=-2, y'=2(1)+2(0)=2, z'=2 → (-2, 2, 2)
Translate (2,0,0): (-2+2, 2+0, 2+0) = (0, 2, 2)

Final point = (0, 2, 2)

Problem 6 (Practice try it yourself)

A point P(3, 3, 3) is transformed using M = T(1,1,1) · S(2,1,0.5) · T(-1,-1,-1) — scaling by factors (2, 1, 0.5) about the fixed point (1,1,1). 

Compute the result step by step, and verify using x'=sx(x-px)+px, y'=sy(y-py)+py, z'=sz(z-pz)+pz.


Conclusion

3D composite transformations build directly on the 2D foundation but introduce a critical new wrinkle: rotations about different axes do not commute, making order even more consequential than in 2D, and rotation about a truly arbitrary axis is itself a multi-step composite operation. 

Mastering the standard scenarios scaling about a fixed point, rotation about an axis parallel to a coordinate axis, rotation about a general axis (via either step-by-step alignment or Rodrigues' formula), and the Scale → Rotate → Translate object placement pattern completes the practical toolkit needed to position and animate objects in any 3D graphics pipeline.

Previous Post
Homogeneous Coordinates in 3D Computer Graphics
Next Post
Projection in 3D Transformation
0 people found this article helpful

Was this article helpful?