lerp - HLSL

Returns x + s(y - x). This linearly interpolates between x and y, such that the return value is x when s is 0, and y when s is 1.

Syntax

ret lerp(x, y, s)

Where:

Name In/Out Template Type Component Type Size
x in scalar, vector, or matrix float any
y in same as input x float same dimension(s) as input x
s in same as input x float same dimension(s) as input x
ret out same as input x float same dimension(s) as input x

Minimum Shader Version

This intrinsic function is supported in the following (or above) shader versions:

Vertex Shader Pixel Shader
vs_1_1 ps_1_4

See Also

HLSL Intrinsic Functions