Forum

Decompose Buffer version

Hi guys! Does somybody have a Buffer version of Decompose (Transform)? Or can you tell me how for example to extract the rotate matrix from TransformBuffer?
Any help is much appreciated!

hi,

have a look at the matrix to see which values are changing. That’s your rotation component. (3d in this example). use one of the following operators to access members of the transform:

dssdsdffds

//one based
float member = myTransform._m11;

// zero based
float member = myTransform._m00;
float member = myTransform[0][0];

https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-per-component-math

or just cast to float3x3 to access your rotation component.

Hi, thank you for this! Maybe this is a bit advanced for me…
I understood how to access the 3x3 rotation component from the whole transformation matrix.
Now I need to somehow convert this float3x3 to XYZ rotation angles, right?

Greetings from the 14th district :)

What do you want to control with the decomposed values? another shader or back to cpu?

I would use it with TransformBuffered. I need something similar to the node GetMatrixPos (Buffer version), but with rotations instead positions. I found some equations for translating rotation matrix to angles and will try to paste them into the code. But I also appreciate any other help.

1180 here :) Did you have a look at the noodles girlpower patch “02_DX11.GeomFX_Instancing.v4p”?

If you come from CPU then just upload your transforms into the transform buffered node.
If you come from GPU you have to create a StructuredBuffer which then you can feed in the same way as the dynamic buffer.

You do not want to convert back and forth to rotation in radians while on gpu. This costs more performance than passing around a rotation matrix float 3x3. If you take a look into “GetMatrixPos Buffer” it selects the translation components like I mentioned.

if you want to get deeper into this: Workshop 'Compute shader' @ NODE17 Forum for Digital Arts - YouTube