2
Matrix is row major
Syoyo Fujita edited this page 2022-12-07 03:57:57 +09:00

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;