Skip to content

Commit 15b3cd3

Browse files
ocarrereEvergreen
authored andcommitted
[Port] [6000.3] docg-7313: Explain how a lower dimension T input value is mapped to the components of A and B
1 parent 8e44236 commit 15b3cd3

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44

55
Returns the result of linearly interpolating between input **A** and input **B** by input **T**.
66

7-
For example, when the value of input **T** is 0 the return value is equal to the value of input **A**, when it is 1 the return value is equal to the value of input **B** and when it is 0.5 the return value is the midpoint of the two inputs **A** and **B**.
7+
Unity calculates the output as:
8+
9+
A + T × (B − A)
10+
11+
The value of input **T** acts as a weight factor applied to the difference between **B** and **A**:
12+
13+
- When **T** is `0`, the output equals **A**.
14+
- When **T** is `1`, the output equals **B**.
15+
- When **T** is `0.5`, the output is the midpoint between **A** and **B**.
16+
17+
The Lerp node uses Dynamic Vector slots, so **A**, **B**, and **T** always resolve to the same component count, which matches the smallest connected vector (larger vectors truncate). Scalars promote to the resolved size by duplicating their value across components.
818

919
## Ports
1020

1121
| Name | Direction | Type | Description |
1222
|:-----|:----------|:---------------|:------------|
13-
| A | Input | Dynamic Vector | First input value |
14-
| B | Input | Dynamic Vector | Second input value |
15-
| T | Input | Dynamic Vector | Time value. Typical range: 0 to 1. Though you can use values outside of this range they may cause unpredictable results. |
16-
| Out | Output | Dynamic Vector | Output value |
23+
| **A** | Input | Dynamic Vector | First input value |
24+
| **B** | Input | Dynamic Vector | Second input value |
25+
| **T** | Input | Dynamic Vector | Time value. Typical range: 0 to 1. Though you can use values outside of this range they may cause unpredictable results. |
26+
| **Out** | Output | Dynamic Vector | Output value |
1727

1828
## Generated Code Example
1929

Packages/com.unity.shadergraph/Documentation~/Node.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ Right clicking on a **Node** will open a context menu. This menu contains many o
4040
**Nodes** interact with the Shader Graph Window's Color Modes. Colors are displayed on nodes underneath the text on the node title bar. See [Color Modes](Color-Modes.md) for more information on available colors for nodes.
4141

4242
<image>
43+
44+
Unity applies each component of T as a weight factor to each component to A and B. If T has fewer components than A and B, Unity casts T to the required number of components. Unity copies the values of the original components of T to the added components.

0 commit comments

Comments
 (0)