CheapContrast and Implicit Truncation of Vector Type

Hello,

I have a material in which I take a texture (which is generated in realtime by a blueprint), blur it and increase the contrast. I want the result to serve as a displacement map for a tessellated surface. However, no matter what I do I get a load of errors. I suspect the four errors at the bottom are because of the two at the top.

I’ve tried using a MakeFloat3 node, putting the CheapContrast result into X and a Constant1 value of 0 into Y and Z. I’ve tried using CheapContrast_RGB as well, and various combinations.

I’m flummoxed. Can anyone please help?

This is driving me potty now. Please someone help!

Please can someone explain why this doesn’t cause an error:

but this does?

Because the node network, that goes into your append node is not scalar, but a vector?

Thanks for replying. Is a vector not just a collection of scalars?

The output from CheapContrast is a ‘Mask(R)’ node, so the Append node receives a scalar to A and a Vector2 to B. Does this not make a Vector3, which would therefore be the same variable type as the ‘1,1,1’ input into the multiply node?

Might be something in the blur node. Whatever. To check what exactly is the cause, you can view HLSL code, and check the lines, that are specified in the error message.

Okay, thanks - I hadn’t thought to do that.

However, the line numbers don’t correspond to anything that makes sense - some are blank and some are comment blocks. Unless I’ve misunderstood the line numbers (I can find no documentation that explains them). I assume it’s the first number in brackets; I don’t know what the range after the comma means (I thought it was the column range but they’re too big).

BTW The blur node returns a Float3 which is why I use a Mask(R) node.

Edit: Ha ha, the line numbers made no sense because of word wrapping in Word. It looks like it is something to do with the blur node but I’m still trying to figure out what’s causing it.

Okay, I’ve had a butcher’s at the code and, as I say, the two truncation errors are caused by two lines in the blur node. In particular:

return Texture2DSample(Tex,TexSampler,UV);

and

CurColor += Texture2DSample(Tex,TexSampler,NewUV)*distpow;

As you can see, both lines are entering or adding a Texture2D to a float3. On the face it I can see why that could cause an error. However, what I don’t understand is why these two lines don’t cause an error in the first of the two cases in the images above, but do in the second. The difference between the two cases occurs after this blur node, and ostensibly the inputs to it are identical in both.

I’m sure it’s something simple but I’ve wasted so much time on it.

PS I did have the whole blur node’s HLSL code in here but it just wouldn’t let me post, even though I was within the character limit.

I’ve eliminated the first two errors - the vector truncation ones - by changing CurColour in the blur node’s custom node’s HLSL code from a float3 to a float4 (and changing the output to float4). However, I still get the other four errors.

It’s definitely something to do with the output from the SpiralBlur node, but I have no idea what the problem is.

Just saying, if this helps out! but when I received the error it was because I accidentally associated the material with Niagara sprites, thus changing it in usage properties. :wink: