Firstborn/Library/PackageCache/com.unity.shadergraph@12.1.11/Documentation~/Twirl-Node.md
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

31 lines
1.3 KiB
Markdown

# Twirl Node
## Description
Applies a twirl warping effect similar to a black hole to the value of input **UV**. The center reference point of the warping effect is defined by input **Center** and the overall strength of the effect is defined by the value of input **Strength**. Input **Offset** can be used to offset the individual channels of the result.
## Ports
| Name | Direction | Type | Binding | Description |
|:------------ |:-------------|:-----|:---|:---|
| UV | Input | Vector 2 | UV | Input UV value |
| Center | Input | Vector 2 | None | Center reference point |
| Strength | Input | Float | None | Strength of the effect |
| Offset | Input | Vector 2 | None | Individual channel offsets |
| Out | Output | Vector 2 | None | Output UV value |
## Generated Code Example
The following example code represents one possible outcome of this node.
```
void Unity_Twirl_float(float2 UV, float2 Center, float Strength, float2 Offset, out float2 Out)
{
float2 delta = UV - Center;
float angle = Strength * length(delta);
float x = cos(angle) * delta.x - sin(angle) * delta.y;
float y = sin(angle) * delta.x + cos(angle) * delta.y;
Out = float2(x + Center.x + Offset.x, y + Center.y + Offset.y);
}
```