A game about forced loneliness, made by TACStudios
1# Rectangle Node 2 3## Description 4 5Generates a rectangle shape based on input **UV** at the size specified by inputs **Width** and **Height**. The generated shape can be offset or tiled by connecting a [Tiling And Offset Node](Tiling-And-Offset-Node.md). Note that in order to preserve the ability to offset the shape within the UV space the shape will not automatically repeat if tiled. To achieve a repeating rectangle effect first connect your input through a [Fraction Node](Fraction-Node.md). 6 7NOTE: This [Node](Node.md) can only be used in the **Fragment** [Shader Stage](Shader-Stage.md). 8 9## Ports 10 11| Name | Direction | Type | Binding | Description | 12|:------------ |:-------------|:-----|:---|:---| 13| UV | Input | Vector 2 | UV | Input UV value | 14| Width | Input | Float | None | Rectangle width | 15| Height | Input | Float | None | Rectangle height | 16| Out | Output | Float | None | Output value | 17 18## Controls 19 20| Name | Type | Options | Description | 21|:------------ |:-------------|:-----|:---| 22| | Dropdown | Fastest, Nicest | Robustness of computation | 23 24## Generated Code Example 25 26The following example code represents one possible outcome of this node. 27 28``` 29void Unity_Rectangle_float(float2 UV, float Width, float Height, out float Out) 30{ 31 float2 d = abs(UV * 2 - 1) - float2(Width, Height); 32 d = 1 - d / fwidth(d); 33 Out = saturate(min(d.x, d.y)); 34} 35```