Unable to understand use of "Lerp" node in this case


Please can anyone tell me what the lerp node is doing in this case ???

Where the red channel of the texture is more ‘on’ ( ie, white ), it will give a number closer to 1, otherwise .2

So, it’s taking a value that is 0-1 and mapping it to -.2 to 1. Which makes no sense, because it’s then clamping it to 0-1 again…

It’s like a desaturate and it cuts out some levels - why does it make no sense?

Well, why bother using a 0-1 to lerp between -.2 and 1, and then clamping it back to 0-1? Also, I though anything under zero ended up as zero anyway?..

Could very well be me… :slight_smile:

Because.
It’s basically creating actually black areas in the image.

Think about it this way.
Take a render cloud, make the cloud slightly darker.

If you do this in photoshop the end result is already in 0 to 1 range. Not the same in engine.

So, if you were to ADD that without the clamp to something, you’ll be effectively making that something -2 in some areas - which is unpilely to be the needed result.
Particularly when you then multiply it by something else.
Whereas X by 0 is?

Ok, reducing info, basically…

Yes.
We all prefer just using the right texture :stuck_out_tongue_winking_eye:

2 Likes

The “Saturate” node should be used instead of a “Clamp 0,1”.

I do this all the time.

Take a greyscale image and you can cut out levels, drop the floor, raise the cieling, etc; it’s VERY useful. If you are using a noise-based alpha, you can expand the range above 1 or below 0 and then saturate to gain/loose the impact of the lows or the highs. More extreme values + saturate are a less-expensive cheap-contrast, which essentially does the same thing anyways.

Single greyscale image can be used to fake-depth on clouds, reactive to the lighting vector and other nifty tricks:

1 Like

If I understand correctly, the compiler will do that for you under the covers.

Yeah, probably. Still, it would be more clear.