Custom HLSL nodes and Matrices


I just hopped into the current UE4 jam and tried to write a custom shader.
I need to apply a matrix transformation for every step of a for loop, so unfortunately I can only apply the transformation right through the custom node and not via the normal UE4 material nodes.

I now wanted to define a transformation matrix and according to microsoft (…cs-hlsl-matrix) HLSL should support matrices which are defined either by something like:
float3x3 TestMatrix = …
matrix <float, 3, 3> Test Matrix = …

Neither does work for me though and I always get an error X3000: syntax error: unexpected token ‘float3x3’.
This is really weird to me as the microsoft page to be native to HLSL and I thought should work in the custom node as it´s straight HLSL as far as I´m aware.
If I´m making some stupid mistake with my assumptions please let me know, I´m pretty new to HLSL.

This is a test matrix I tried defining:

// IdentityMatrix
float3x3 IMatrix = {
1.f, 0.f, 0.f,
0.f, 1.f, 0.f,
0.f, 0.f, 1.f

Which does report the error X3000.

**Alternatively **what could also REALLY help me and make the above irrelevant for now (though I´d still be interested in a solution for matrices) would be the ability to call the “TransformVector” node straight out of the custom node. I know that for the Noise node this works by calling MaterialExpressionNoise(…) with the needed parameters but I didn´t have any luck with “MaterialExpressionTransform”, “MaterialExpressionTransformVector”, “Transform” or “TransformVector”.
If someone could hint me to whether it´s possible to call this node out of the custom node and if so how, it would be greatly appreciated.

Thanks a lot in advance and happy jamming to anyone joining as well! :slight_smile:

Kind regards,

Of right after posting I find the solution…
It´s so weird that I can never figure it out, looking into it for hours at times but as soon as I make a post I almost always find a solution.

So for anyone having a similar problem:
float3x3 TestMatrix = … still doesn´t seem to work but matrix<float, 3, 3> does!

It was giving me an error because I forgot a silly semicolon before defining another matrix and because the error didn´t return any line number I thought the error affected every matrix (like it did with float3x3) and not just one of them.