Lerp

Linear Interpolation

It would commonly take in 3 scaler or 2 vector and a scaler, and return the result of the formula

x + s(y-x).

Gameplay

I often find this function useful for cheap generation of points along a relatively straight line. It is also very useful to calculate the display of health/power/magic bar, eg

healthBarLength = lerp(healthBarStart, healthBarMaxLength, %healthLeft)

In UI it is a very good helper function to convert relative screencoord to absolute screencoord

Graphics

It is frequently used for alpha blending, blending of normal maps, terrain splatting. I like to use it for signal scaling,

eg getting value max(0, NdotL) / max(0, NdotV) to scale to some other values for various effects.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>