Super useful UE4 Remap material function

This is one of my most used material functions. I often have to get an input value and remap that into a range that is more useful. Usually I like to get things and fit them into a 0 to 1 range that I can then use as a mask for lerps/multiplies etc.

The math for this can be found in this stack overflow question. It’s pretty simple. Houdini users would know this as a ‘fit’ function.



It takes 5 inputs, the old min and max of the range that you want to map from, the new min and max that you want to remap to and the input value that will go through this process.

One example is this height blend. We input the height (Z in unreal) of a landscape and we take the top height and a lower height which we want to falloff to, and then remap that into a range that is 1 at the top and 0 at the bottom. There are so many uses of having a mask that is between 0 and 1. You can combine it with other masks in the same range that might have been achieved through other means and they now exist in the same range space and this mixture now has meaning. It’s called normalization and is something I’ll probably go into at some point in the future.



I’ve used this function with the distanceToNearestSurface node a lot as I can get the raw distance value and create my own masks by changing the oldMax input as a parameter. This is how I did part of the water flow material here.

Happy game deving!

One thought on “Super useful UE4 Remap material function

  1. Do you have the layout of how this Material Function is set up for the MF_Remap? I believe I understand what you are doing but I’m wanting to check against what I am doing.

Leave a Comment