# lerp

Performs a linear interpolation.

ret lerp(x, y, s) |
---|

## Parameters

Item | Description |
---|---|

x |
[in] The first-floating point value. |

y |
[in] The second-floating point value. |

s |
[in] A value that linearly interpolates between the x parameter and the y parameter. |

## Return Value

The result of the linear interpolation.

## Type Description

Name | Template Type |
Component Type |
Size |
---|---|---|---|

x |
scalar, vector, or matrix |
float |
any |

y |
same as input x |
float |
same dimension(s) as input x |

s |
same as input x |
float |
same dimension(s) as input x |

ret |
same as input x |
float |
same dimension(s) as input x |

## Remarks

Linear interpolation is based on the following formula: x*(1-s) + y*s which can equivalently be written as x + s(y-x).

## Minimum Shader Model

This function is supported in the following shader models.

Shader Model | Supported |
---|---|

Shader Model 2 (DirectX HLSL) and higher shader models | yes |

Shader Model 1 (DirectX HLSL) | yes (vs_1_1 and ps_1_1) |