Skip to content

The Model Matrix

Move, turn and stretch an object by dragging the numbers that do it, and watch the matrix fill in as you go.

What you should come away with: Why a matrix chain reads right to left, and why the columns are the object’s own axes.

  • X
  • Y
  • Z
drag or arrow keys to orbit

The matrix

T translate
1.000.000.001.40
0.001.000.000.50
0.000.001.000.00
0.000.000.001.00
R rotate
0.910.000.420.00
0.001.000.000.00
-0.420.000.910.00
0.000.000.001.00
S scale
1.000.000.000.00
0.001.000.000.00
0.000.001.000.00
0.000.000.001.00
M = T · R · S
0.910.000.421.40
0.001.000.000.50
-0.420.000.910.00
0.000.000.001.00

The first three columns of M are the cube’s own axes after the transform — that is exactly what the red, green and blue arms on the canvas are drawing. The fourth column, in amber, is where its origin ended up. Drag a translate slider and watch only that column move.

Where that leaves you

You can now read a model matrix without multiplying it out — which column is the position, which three are the object’s own axes — and say why turning a cube and then moving it leaves it somewhere else entirely from moving it and then turning it.

This did not teach you what happens when one object hangs off another. Every matrix here starts at the world origin, so the compounding chain a scene graph keeps — each object’s matrix multiplied by its parent’s before it ever reaches a shader — never appears; that is among the things a library does on your behalf, and the Three.js entry under /tech is where this site says so.