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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to Properly use LERP Material Nodes?

Hello all. I apologise in advance for such a basic question, but I have found a problem that has left me stumped. I am trying to understand how materials work, so I thought I would make a very simple expression:

Broken Material

The intent here is to take the horizontal value of the uv, subtract 0.5 from it and take the absolute value, so on a simple UV square, the value will start at 0.5 on the left edge, drop to 0 on the middle and rise back to 0.5 on the right edge.

This value then is fed into the alpha field of lerp with A set to 1 (which should work as white (1,1,1) ) and B set to 0 (which should work as black (0,0,0)). Yet the result is a completely white image. If, however, I invert the parameters order, we get:

Working Material

At first I thought this might simply be an issue of A needing to be lesser than B, but not only would this seem rather weird, the expression works as intended when I use a simple linear u coordinate as the input.

Simple Lerp

So, I am pretty much at a loss to figure out what the issue here is. Is there a problem with the math expressions I used to put u's value in range? Am I just not using lerp correctly? My editor version is 4.22.1 and I am doing this on a Basic Code C++ project with starter content, if it makes a difference.

Thanks for reading this question!

Product Version: UE 4.22
bad-lerp.png (342.2 kB)
good-lerp.png (434.6 kB)
simple-lerp.png (366.3 kB)
more ▼

asked Apr 30 '19 at 05:12 PM in Rendering

avatar image

3 1 2

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

1 answer: sort voted first

Apply some rubberducking here. On the left edge, you UV.r value is zero. Subtracted 0.5, it becomes -0.5, absolute of which is 0.5. lerp between 1 and 0 on 0.5 is 0.5.

In the middle, you UV.r value is 0.5. Subtracted 0.5, it becomes 0.0, absolute of which is 0.0. lerp between 1 and 0 on 0.0 is 1.0.

On the right edge, you UV.r value is 1. Subtracted 0.5, it becomes 0.5, absolute of which is 0.5. lerp between 1 and 0 on 0.5 is 0.5.

So, everything works as intended.

more ▼

answered Apr 30 '19 at 06:37 PM

avatar image

7.8k 130 31 292

avatar image Alex_AB Apr 30 '19 at 07:26 PM

Thank you very much! The answer was rather simple and yet I spent so many hours trying to get it...

(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