Linear interpolation

From Tech Artists Wiki

Jump to: navigation, search

Lerp stands for Linear Interpolation. It is a very common algorithm and is used in computer graphics constantly, since it is one of the cheapest interpolation algorithms.

It is easiest to think of a Lerp as a line: the minimum value is on one end, the maximum value is on the other, and the lerp term is how far between the min and max value to find. If the min is 0, and max is 1, a lerp term of x will return x. A more thorough understanding may also be derived from the functions provided below.

[edit] In Languages

  • HLSL has a built in Lerp function:
lerp(minVal, maxVal, term)
fn lerp minVal maxVal term = (maxVal - minVal) * term + minVal

The Wikipedia article on Linear Interpolation has useful mathematical formulas.

Personal tools