Very simple Range Mapping, Value Remap in Material Editor

Hello there,
Many times I have met a problem where I needed a normal range mapper in the materials, like in blueprints, but there seemed to be no function to do this, built in.
I put together this, it’s simple, but works nicely.
You can put in values such as 1000 to 45000, and it remaps it to any value you want, for example 0 to 1. I use it mostly with clamp and post process materials and custom depth pass. The post process material then can only influence certain object in certain distance, for example from 10 meters to 50 meters.
Hope it’ll be useful. I attached 4.18 version of the uasset, but you guys can replicate it from the print screen.

The idea is this: NewMin + (InValue - OldMin) * (NewMax - NewMin) / (OldMax - OldMin)

Best,
Pavel

1 Like

I don’t really know much about this level of math, but by purely looking at the debug values and doing som trial&error, it seems that this is the right formula. I would still thank you because I’m only good at fiddling around, would have never come up with it on my own! :slight_smile: