[Maya] Matrix components in node editor

I’m trying to get each value of matrix (16 floats) from matrix.
I don’t need decomposeMatrix, I just need clean values, so I can pass them later to ShaderFx
(because it doesn’t let me as full matrix, so I will go per component).

Is it possible to achieve this using Node Editor. Expressions are not real-time enough :slight_smile:

If not:

  • then I’ll look into scriptJob (which is probably slow)
  • or API node, but I don’t want the problems that .mll/.bundle compiling/sharing makes over longer period of time

here’s how to get a 4 by 3 matrix from the 4 by 4:

The first row is the vector multiplication of (1,0,0) against the matrix;
the second row is the vector multiplications of (0,1,0) against the matrix;
the third is the vector multiplications of (0,0,1) against the matrix;
the fourth is the point multiplication of (0,0,0) against the matrix;

The last column is always (0,0,0,1)

here’s how to get a 4 by 3 matrix from the 4 by 4:

The first row is the vector multiplication of (1,0,0) against the matrix;
the second row is the vector multiplications of (0,1,0) against the matrix;
the third is the vector multiplications of (0,0,1) against the matrix;
the fourth is the point multiplication of (0,0,0) against the matrix;

That gives you the left-most 12 items of the matrix.
The last column is always (0,0,0,1)

Thank Theodox.

I’m not at PC currently, but I’m gonna ask this quickly, before USA goes to sleep, so hopefully I will have less to figure out tomorrow in the morning at work.

Do you happen to know if there is node to multiply matrix by vector in Maya? Can’t remember if I saw something like that.

The node you want is the “vectorProduct” node. If you can’t find it, make sure the “matrixNodes” plugin is loaded.

Oh i didn’t know vectorProduct has matrix multiplication, thanks a lot guys, you helped me ton!