Material Function stop working when turning Constant 4 vector into vector parameter?
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 http://udn.epicgames.com/Three/MaterialsCompendium.html#VectorParameter there shoulnd't be any difference between a constant 4 and a vector parameter.
Why is this?
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.
Here is some more info on all of this:
Hope that helps Sitrec! :)
answered Nov 09 '14 at 11:08 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here