If you are using the row-vector convention for your matrix math, that should be correct.

However, I’m not sure why you need to go to such trouble. If the particles are simulated in the particle system’s local space, then you can apply the transform in the particles’ vertex shader just like any other shader, can’t you?

Hi,

I am now want to make my particle system support scaling. My particle system can be attached to an arbitrary node. Here is my plan:

I am not sure if I can extract the scaling component from the matrix by using the following code:

const FLOAT Sum0 = (M[0][0] * M[0][0]) + (M[0][1] * M[0][1]) + (M[0][2] * M[0][2]);

const FLOAT Sum1 = (M[1][0] * M[1][0]) + (M[1][1] * M[1][1]) + (M[1][2] * M[1][2]);

const FLOAT Sum2 = (M[2][0] * M[2][0]) + (M[2][1] * M[2][1]) + (M[2][2] * M[2][2]);

FLOAT ScaleX = sqrt(Sum0);

FLOAT InvScaleX = 1.f / ScaleX;

M[0][0] *= InvScaleX;

M[0][1] *= InvScaleX;

M[0][2] *= InvScaleX;

FLOAT ScaleY = sqrt(Sum1);

FLOAT InvScaleY = 1.f / ScaleY;

M[1][0] *= InvScaleY;

M[1][1] *= InvScaleY;

M[1][2] *= InvScaleY;

FLOAT ScaleZ = sqrt(Sum2);

FLOAT InvScaleZ = 1.f / ScaleZ;

M[2][0] *= InvScaleZ;

M[2][1] *= InvScaleZ;

M[2][2] *= InvScaleZ;

Fix me if I am wrong please. Thanks in advance.