Subtracting two 4x4 Matrices - is this possible?

math, matrix, opengl

Solution

You'll need to multiply the matrix at frame x with the inverse of the matrix at frame 0.

matrixOffset = inverse(matrixAtFrame0) * matrixAtFrameX

This will give you the relative transformation and rotation between the frames.

Problem

I have two 4x4 OPENGL Matrices - 1st matrix holds rotation and position of an object at frame 0. 2nd matrix holds rotation and position of an object at frame X; I want to retrieve a movement offset of an object between frame 0 and X, is this enough ( possible ) if I just subtract both? ``` CMatrix4x4 offsetMatrix = matrixAtFrameX - matrixAtFrame0; ``` What I am doing is exporting per frame Bone transformation matrix where this matrix is an offset of the transformation between frame 0 of the animation and frame X. Can I subtract both matrices ? What are the results ?

Original source