Unity Products:Amplify Shader Editor/Lerp: Difference between revisions

From Amplify Creations Wiki
Jump to navigation Jump to search
ampwiki>Amplify Borba
No edit summary
 
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
== Lerp Node ==
== Lerp Node ==


The Lerp node ''( shortcut: L key )'' calculates a linear interpolation between two values [[#paramA|A]] and [[#paramB|B]] by [[#paramAlpha|Alpha]]. In other words it will generate a new blended value between A and B according to a third one called Alpha, a.k.a Interpolator, using the the expression '''( ( 1 - A ) * I + B * I )'''. The interpolator value is ranged between [0 - 1] on which it will return ''A'' if ''I = 0'' and ''B'' if ''I = 1''.
The Lerp node ''( shortcut: L key )'' calculates a linear interpolation between two values [[#paramA|A]] and [[#paramB|B]] by [[#paramAlpha|Alpha]]. In other words it will generate a new blended value between A and B according to a third one called Alpha, a.k.a Interpolator, using the the expression '''( ( 1 - A ) * I + B * I )'''. The interpolator value is expected to be ranged between [0 - 1] on which it will return ''A'' if ''I = 0'' and ''B'' if ''I = 1''.


'''NOTE:''' Linear interpolation between multi-channel data types are done per-channel. If ''A'' and ''B'' have different channel amounts a cast is done to match the one with the most amount of channels.
'''NOTE:''' Linear interpolation between multi-channel data types are done per-channel. If ''A'' and ''B'' have different channel amounts a cast is done to match the one with the most amount of channels.
Line 45: Line 45:
|-
|-
| Alpha
| Alpha
| Interpolator value. This port is clamped to range [0-1].
| Interpolator value. This port is expected to be in range [0-1].
| Float <sup id="ref1">[[#anchor|[1]]]</sup>
| Float <sup id="ref1">[[#anchor|[1]]]</sup>
|}
|}

Latest revision as of 12:03, 17 November 2024

Back to Node List

Lerp Node

The Lerp node ( shortcut: L key ) calculates a linear interpolation between two values A and B by Alpha. In other words it will generate a new blended value between A and B according to a third one called Alpha, a.k.a Interpolator, using the the expression ( ( 1 - A ) * I + B * I ). The interpolator value is expected to be ranged between [0 - 1] on which it will return A if I = 0 and B if I = 1.

NOTE: Linear interpolation between multi-channel data types are done per-channel. If A and B have different channel amounts a cast is done to match the one with the most amount of channels.


Nodes used: Texture Sample, Lerp

Node Parameter Description Default Value
A First value of the interpolator operation, fully outputted when Alpha = 0. Only visible if the respective input port is not connected. 0
B Last value of the interpolator operation, fully outputted when Alpha = 1. Only visible if the respective input port is not connected. 0
Alpha Interpolator value. Only visible if the respective input port is not connected. 0


Input Port Description Type
A First value of the interpolator operation. Fully outputted when Alpha = 0. Float [1]
B Last value of the interpolator operation. Fully outputted when Alpha = 1. Float [1]
Alpha Interpolator value. This port is expected to be in range [0-1]. Float [1]

  1. ^ Port automatically adapts to all connection types except Matrices and Sampler types.

Math Operators - Lerp/Remap

Back to Node List