x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Material Graph

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?

Product Version: UE 4.19
Tags:
more ▼

asked Apr 26 '18 at 12:51 PM in Using UE4

avatar image

Bob3DGames
68 8 9

avatar image Bob3DGames May 13 '18 at 03:37 PM

This is driving me potty now. Please someone help!

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

No errors

but this does?

Irritating errors

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered May 13 '18 at 03:44 PM

avatar image

Deathrey
7.1k 126 27 286

avatar image Bob3DGames May 13 '18 at 03:56 PM

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?

avatar image Deathrey May 13 '18 at 04:11 PM

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.

avatar image Bob3DGames May 13 '18 at 04:46 PM

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.

avatar image Bob3DGames May 14 '18 at 07:11 PM

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.

avatar image Bob3DGames May 19 '18 at 01:23 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question