Firstborn/Library/PackageCache/com.unity.shadergraph@12.1.11/Documentation~/Ellipse-Node.md

29 lines
1.2 KiB
Markdown
Raw Normal View History

2023-03-28 13:24:16 -04:00
# Ellipse Node
## Description
Generates an ellipse 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 dot effect first connect your input through a [Fraction Node](Fraction-Node.md).
NOTE: This [Node](Node.md) can only be used in the **Fragment** [Shader Stage](Shader-Stage.md).
## Ports
| Name | Direction | Type | Binding | Description |
|:------------ |:-------------|:-----|:---|:---|
| UV | Input | Vector 2 | UV | Input UV value |
| Width | Input | Float | None | Ellipse width |
| Height | Input | Float | None | Ellipse height |
| Out | Output | Float | None | Output value |
## Generated Code Example
The following example code represents one possible outcome of this node.
```
void Unity_Ellipse_float(float2 UV, float Width, float Height, out float4 Out)
{
float d = length((UV * 2 - 1) / float2(Width, Height));
Out = saturate((1 - d) / fwidth(d));
}
```