Material Editor: Failed to cast float4 to float3 when using Vector parameter

Hi, the following error happens on both Lerp and If-nodes.

I tried using component mask to re-match the number of params, but to no effect.

Error message:

**Arithmetic between types float4 and float3 are undefined.

Coercion failed: material.vectorexpressions[1].rgb: float3 → unknown

Coercion failed: Local0.rgba: float4 → unknown.**

The error does NOT occur when using float4 constant, as soon as I convert it to float4 parameter, conversion no longer works.

The Scene Texture outputs Color as a float4, you need to use a component mask and get only the RGB channels. Alternatively, you can append the alpha of your outline color to the RGB

2 Likes

Thanks, I feel like a fool now :slight_smile: I figured the white pin of the parameter used all 4 channels, this is slightly odd behavior since I convert my constant to exactly the same thing as dynamic parameter (both still have 4 channels from my understanding) yet it is causing this error.

The component mask does fix this issue for me.

p.s. funny how you are showing me the exact same thing from your own library :wink:

1 Like

Haha yes I noticed that you are making an outline post process, so I found mine and did a screengrab. Yes i find that a bit odd too but its been like that since the UE3 days and I am used to it now.

Didn’t work for me, I had to apply mask to everything (both color inputs as “R G B” and alpha input as “A”)

You saved me

Along similar lines, I needed to multiply a texture that had been passed through a static component mask parameter and it was throwing floaty errors. These comments prompted me to use a componentmask (R) on the other pin of the multiply node, which got things working again :slight_smile:

Thought I’d post here in case anyone’s been googling around, since i didn’t find anything that dealt with my exact issue…

Hey Tom,
I’m working on highlight material too. I had this problem too but I have another problem also.
It says somewhere in the material I’m passing float4 instead of float but I have no idea where is that place.
Can you help me or if it is possible for you, send me the material you made?
Thank you

Te amo

This is what I must do to solve this issue. (UE5 now)
I need a float4, but the white node only gives me a float3.
So I had to make a float4 there, which was quite strange.

1 Like