Skip to content

Matrix is row major

Syoyo Fujita edited this page Dec 6, 2022 · 2 revisions

pxrUSD uses row-major order for Matrix, so do it in TinyUSDZ also.

in row-major order, if you describe matrix multiplication in C++ as

m = a * b;

a is evaluated(applied) firstly. So if you want to compute world matrix of a given node(GetLocalToWorldTransform in pxrUSD), you need to describe C++ code as

worldMat = localMat * parentWorldMat;

For transforming vertex v with TRS matrix(translation, rotation, scale), you need to do

M = S * R * T;
v' = M * v;
Clone this wiki locally