Remap

Remap converts a value from one range to another, preserving its relative position. A value in [in_min, in_max] is returned as the corresponding value in [out_min, out_max]. Values outside [in_min, in_max] are not clamped and will extrapolate beyond [out_min, out_max]. It works by performing an InverseLerp, followed by a Lerp.

Parameters:

  • value is the input value.
  • in_min and in_max define the original range of values (input range).
  • out_min and out_max define the target range of values (output range).

Use cases:

  • Procedural Generation: remapping an elevation value [-1000, 1000] to a color index [0, 255].
  • Animation: Driving a door’s rotation [0°, 90°] from a proximity value [0.5, 3] so it starts opening when you get close.
  • Shadow Bias: Mapping surface slope [0°, 90°] to a bias value [0.001, 0.01].

Related