So, I made a material function to select which RGB and A channel to sample from using a Constant 4 vector as a mean to choose channel. This works great but as soon as I turn the constant 4 vector into a vector parameter so i can instance the material I get the following errors: [SM5 Function MF_RGBorA: Cannot cast from float3 to float4.
And [SM5 Function MF_RGBorA: (node If) If input A must be of type float.
It works great when I’m not using a vector parameter. According to UDK | MaterialsCompendium there shoulnd’t be any difference between a constant 4 and a vector parameter.
I also had some issues with VectorParameters, where it should work, but won’t. Here are a couple things to try:
Use the Main output pin and plug it into an Append node, and add the alpha output to the 2nd slot of the append, then try using the output of that to the node you are trying to connect.
You could also choose to use a collection parameter (and a MaterialParameterCollection) which is useful when you have many parameters to set inside a material. The default output from a Collection Vector parameter is always 4-channel, but then you will need to us a RGB ComponentMask for any 3 channel inputs.
Are you, and if so how are you, using a LERP or IF node in your material function? Both of these errors may be a result of not being able to compare vectors and floats in a 1 to 1 fashion?
Apparently this is still a thing, as I had just the same problem and fixed it with an append like below.
Anyone got an explanation for a newbie what’s happening here?