Skip to content

Commit 733e2ac

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.0] docg-7313: Explain how a lower dimension T input value is mapped to the components of A and B
1 parent 567e070 commit 733e2ac

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

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

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

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

7-
The output is calculated as `A + T * (B - A)`. The value of input **T** acts as a weight factor applied to the difference between **B** and **A**:
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**:
812

913
- When **T** is `0`, the output equals **A**.
1014
- When **T** is `1`, the output equals **B**.
1115
- When **T** is `0.5`, the output is the midpoint between **A** and **B**.
1216

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.
18+
1319
## Ports
1420

1521
| Name | Direction | Type | Description |
1622
|:-----|:----------|:---------------|:------------|
17-
| A | Input | Dynamic Vector | First input value |
18-
| B | Input | Dynamic Vector | Second input value |
19-
| 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. |
20-
| 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 |
2127

2228
## Generated Code Example
2329

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)