VectorParameter incorrectly converted to MaterialFloat3 in custom node

I noticed that when I use a VectorParamater node (which has 4 components), it will not be used correctly in a custom node. When I look at the HLSL code, I see that this parameter is converted to MaterialFloat3, leaving the 4th component missing.
I assume this is a bug because that doesn’t make sense, and I don’t see any way to change this behavior myself.
Could this please be fixed?
Or if it’s intented behavior, can you let me know how to get all 4 components of the VectorParameter in my custom node?

Thanks!

Bram

Hi BramV -

Can you share the HLSL you are using in the Custom Node as well as your variable setup in the Custom Node’s Details panel?

Thank You -

Eric Ketchum

This is the revelant HLSL code:

// Uniform material expressions.
MaterialFloat3 CustomExpression0(FMaterialPixelParameters Parameters,MaterialFloat3 testParam)
{
float4 test = testParam;
return float3(test.x, test.y, test.w);
}

I just made a very easy example, see screenshot

Hi BramV -

I have been able to confirm the issue here and have entered a bug report for it, for reference it it UE-21967. As we continue to investigate, I will keep you informed here.

Thank You

Eric Ketchum

This bug is still occurring for me in 4.24. Supposedly fixed in 4.18.

This error still occuring for me in 4.25.1 - I am able to connect a constant v4 to the “Heightmap Channel Selector (v4)” input on the NormalfromHeightmap material function but when I change to a vecto parameter, it gives error “cannot cast float3 to float4”

I was able to correct this by appending the Alpha channel before connecting to function input as seen in image below