Generates a rounded polygon shape based on input **UV** at the size specified by inputs **Width** and **Height**. The input **Sides** specifies the number of sides, and the input **Roundness** defines the roundness of each corner.
You can connect a [Tiling And Offset Node](Tiling-And-Offset-Node.md) to offset or tile the shape. To preserve the ability to offset the shape within the UV space, the shape does not automatically repeat if you tile it. To achieve a repeating rounded polygon effect, first connect your **UV** input through a [Fraction Node](Fraction-Node.md).
You can only use the Rounded Polygon Node in the **Fragment** [Shader Stage](Shader-Stage.md).
## Ports
| Name | Direction | Type | Binding | Description |
float chamferAngle = Roundness * halfAngle; // Angle taken by the chamfer
float remainingAngle = halfAngle - chamferAngle; // Angle that remains
float ratio = tan(remainingAngle) / tan(halfAngle); // This is the ratio between the length of the polygon's triangle and the distance of the chamfer center to the polygon center
// Center of the chamfer arc
float2 chamferCenter = float2(
cos(halfAngle) ,
sin(halfAngle)
)* ratio * diagonal;
// starting of the chamfer arc
float2 chamferOrigin = float2(
1.,
tan(remainingAngle)
);
// Using Al Kashi algebra, we determine:
// The distance distance of the center of the chamfer to the center of the polygon (side A)
float distA = length(chamferCenter);
// The radius of the chamfer (side B)
float distB = 1. - chamferCenter.x;
// The refence length of side C, which is the distance to the chamfer start
float distCref = length(chamferOrigin);
// This will rescale the chamfered polygon to fit the uv space