Polygon

Polygon Generator icon

The Polygon Image Generator draws a regular polygon, such as a triangle, a square, a pentagon or a hexagon, procedurally and at any resolution. It can be filled or drawn as an outline, its corners can be rounded, and every setting can be animated, linked or driven by other Generators, including the number of sides.

Use it for:


Quick Navigation



Creating and Connecting a Polygon

Like any Image Generator, the Polygon can be connected to any image parameter, for example:

The quickest way to create a layer with a Polygon as its source is described in Adding Layers:

To use it with any other image parameter, such as a Mask, click the parameter's slot and choose Polygon from the list of Generators on the right.

By default, you get a white hexagon with a Radius of 100 pixels, centered in the composition. The center of the polygon is set by the Offset parameter, in pixels, relative to the center of the composition: positive X values move it to the right, positive Y values move it up.

Tip:

You can also move, scale and rotate the polygon with the layer's Transform, like any other layer. The Polygon has no rotation parameter of its own, so use the Transform to turn it. Use Offset and Radius when you want the shape itself to change, for example to keep an outline thickness constant while the polygon grows.

Note:

The way you define the Color of the polygon depends on the composition. When its Color Management is turned off, there is only one way to define a color. When it is set to OpenColorIO, every color parameter gets an extra Colorspace option, which tells in which colorspace the color is expressed. See Colorspace.

Choosing the Number of Sides

The Sides parameter sets the number of sides of the polygon: 3 for a triangle, 4 for a square, 5 for a pentagon, and so on. The Radius is the distance from the center to the corners, so all the corners lie on a circle of that radius, whatever the number of sides.

A triangle, a square, a pentagon, a hexagon and an octagon, each inside an orange circle that touches its corners.
Figure 1The orange circle marks the Radius: every corner lies on it.
Then paste in the Project panel. Learn more

The polygon always rests on a flat side at the bottom: a triangle or a pentagon points up, a square stands upright, and a hexagon has a corner on the left and on the right. To turn it, rotate the layer with its Transform.

Sides is not limited to whole numbers. Between two whole values, the polygon goes smoothly from one shape to the next, with a small notch at the top while the new corner forms. Between 2 and 3, a triangle grows from a flat line; at 2 or below, nothing is drawn. Animate Sides to morph a shape into another:

Sides animated from 2 to 8 and back. Only the Sides parameter is animated.
Then paste in the Project panel. Learn more

Filled or Outline: the Edge Mode

The Edge Mode menu decides whether the Polygon is filled, drawn as an outline, or turned into a gradient, and how the outline is measured.

Three hexagons: filled, an outline defined by two radii, and an outline defined by a thickness.
Figure 2The orange line marks the Radius, the blue line marks the Edge Radius.
Then paste in the Project panel. Learn more
Note:

The Thickness and the Edge Radius are measured along the corners, not across the sides. The sides of an outline are therefore a little thinner than its corners: on a hexagon, a Thickness of 20 gives sides about 17 pixels wide. The fewer the sides, the larger the difference.

Note:

Only the parameter matching the current mode has an effect: Edge Radius is used in Edge Radius mode, and Thickness in the three thickness modes.

Keeping Proportions with the Radius Scaled Modes

In Thickness mode, the outline keeps the same width in pixels whatever the Radius. This is what you want for a clean outline, but when the polygon grows or shrinks during an animation, a fixed outline can look too heavy on a small polygon and too thin on a large one.

The Radius Scaled Thickness mode solves this by expressing the Thickness as a percentage of the Radius: with a Thickness of 20, the outline is always 20% of the Radius, and the polygon keeps its proportions at any size.

Top row: three hexagon outlines with the same width. Bottom row: three hexagon outlines whose width grows with their radius.
Figure 3The same Thickness value in Thickness mode (top) and Radius Scaled Thickness mode (bottom).
Then paste in the Project panel. Learn more

The Radius Scaled Thickness & Feather mode goes one step further and also scales the Feather sizes with the Radius, so a soft outline keeps exactly the same look while its size is animated.

Tip:

To build a pulse, use Radius Scaled Thickness & Feather, animate the Radius from a small to a large value and fade the Color alpha out at the same time. The outline keeps its shape from start to finish, with no extra keyframes on Thickness or Feather. The Circle page shows this technique with rings.

Rounding the Corners

Roundness Outer rounds the outer outline of the polygon, in pixels. The corners stay on the Radius and the sides bulge outward, so the shape moves from a sharp polygon toward a circle:

Four hexagons with increasing Roundness Outer values, from sharp corners to a full circle.
Figure 4The orange circle marks the Radius. The corners stay on it while the sides bulge outward.
Then paste in the Project panel. Learn more

Going above the Radius does not give a rounder shape: it turns the polygon into a pinwheel, as described in Pinwheels below.

On an outline, Roundness Outer rounds the outer edge, and Roundness Inner rounds the inner edge. Combine them to get a soft, rounded outline, or round only the inside for a nut-like shape.

Three hexagon outlines: with a rounded outer edge, with a rounded inner edge, and with both edges rounded.
Figure 5Roundness Outer and Roundness Inner on a Thickness outline. The orange line marks the Radius.
Then paste in the Project panel. Learn more
Note:

A filled polygon (Edge Mode set to None) has no inner edge, so Roundness Inner has no effect on it.

Pinwheels: Roundness Above the Radius

When Roundness Outer is larger than the Radius, each side becomes an arc too wide to fit between its two corners. The arcs overshoot the corners and the polygon turns into a pinwheel: a round core of the size of the Radius, with one curved blade per side. The higher the value, the longer the blades.

Hexagons with a Roundness above the Radius: small blades, longer blades, a pinwheel outline, and a hexagonal frame with a pinwheel-shaped hole.
Figure 6Roundness values above the Radius. The orange circle marks the Radius.
Then paste in the Project panel. Learn more

With the Output Format on Auto, the image grows with the blades, so they are never cut. Combined with a rotation of the layer, an animated Roundness makes a nice spinner, a stylized sun or a loading indicator:

Roundness Outer animated from 150 (the Radius) to 320 and back, with the layer Rotation animated at the same time.
Then paste in the Project panel. Learn more

Soft Edges with Feather

Two parameters soften the edges of the polygon:

A hexagon with a soft outer edge, an outline with a soft inner edge, and an outline with both edges softened.
Figure 7The orange lines mark the edges before feathering.
Then paste in the Project panel. Learn more

The feather is centered on the edge: it fades out on both sides of it, so the polygon keeps the same apparent size while you soften it. With a Feather Outer Size of 40, the edge fades over 80 pixels, from 40 pixels inside the edge to 40 pixels outside.

Note:

A filled polygon (Edge Mode set to None) has no inner edge, so Feather Inner Size has no effect on it. Switch to one of the outline modes to use it.

Inverting the Polygon

Enabling Invert swaps the inside and the outside of the polygon: the color fills everything around it, and the polygon itself becomes a transparent hole. This is useful to cut a polygonal hole in a solid color, or to frame an image with a polygonal window.

The result depends on the Output Format, which defines the size of the image produced by the Generator:

Left: an inverted hexagon with Auto output format fills only a square. Right: with Unbounded output format it fills the whole frame.
Figure 8The same inverted, feathered hexagon with two different Output Formats.
Then paste in the Project panel. Learn more
Warning:

When you enable Invert, do not keep the Output Format on Auto: the inverted color would be clipped to a square around the polygon, as shown on the left of Figure 8. Use Unbounded instead.

Distance Field

In Distance Field mode, the value of each pixel depends on its distance to the nearest side of the polygon. Where the gradients from two sides meet, they form ridges that run from the corners to the center, which gives a beveled, pyramid-like look. Use it as a soft polygonal matte, for a quick embossed look, or as a map that drives a Modifier.

The Normalize Distance Field option decides how the distance is stored in the pixels:

Unlike the other modes, the distance field does not stop at the edges: outside the polygon, the values keep decreasing and become negative. Autograph processes images in 32-bit floating point, so these negative values are kept, and they appear black when the polygon is composited over other layers. How far they extend depends on the Output Format:

Left: a hexagonal distance field surrounded by a dark square. Right: the same distance field fading into black over the whole frame.
Figure 9A normalized distance field over a grey background. The orange line marks the edge, where the value is 0.
Then paste in the Project panel. Learn more

Thickness, Edge Radius and the Feather sizes have no effect in this mode. With Invert enabled, the values are reversed: 0 at the center, 1 on the edges, and above 1 outside the polygon.

Tip:

The Viewer displays values above 1.0 as white and negative values as black, but they are still there. To read them, activate the Color Picker with the dropper icon at the bottom right of the Viewer, then hover over the polygon: the Working Space RGBA values show the actual value under the cursor (see Overbright and negative values). To keep these values when rendering, use a floating-point format such as OpenEXR.

Fitting the Polygon in a Format

When Output Format is set to Format Preset, Composition Format or Custom Format, the Polygon behaves differently: it ignores Radius and Offset, and stretches to fit that format. Its corners lie on the largest ellipse that fits inside the format, which gives you a polygon whose width and height you control independently.

Three polygons stretched inside orange rectangles: a filled hexagon, a hexagon outline and a triangle.
Figure 10Polygons drawn with a Custom Format. Sides and Edge Mode still apply.
Then paste in the Project panel. Learn more
Tip:

Animate the Format rectangle in Custom Format mode to squash and stretch the polygon without touching its outline thickness.

Motion Blur

When the polygon moves quickly, because its Offset or Radius is animated, the Polygon can render its own motion blur. Increase Divisions to enable it: this is the number of samples taken during the shutter interval, and higher values give a smoother blur at the cost of render time. Shutter Angle sets the length of the blur, and Shutter Phase sets when the shutter opens relative to the current frame. See Motion Blur for more details.


Controls

Parameter / Script Name Type Default Function
Enabled / enabled Boolean On Turns the Generator on or off. When off, the Generator produces an empty image.
Output Format / output_format_mode Choice Auto Defines the size of the generated image. See Inverting the Polygon and Fitting the Polygon in a Format.
- Unbounded: The image has no limits. Use it with Invert and Distance Field.
- Format Preset: Stretches the polygon to the selected preset.
- Composition Format: Stretches the polygon to the composition.
- Custom Format: Stretches the polygon to the Format rectangle.
- Auto: The image fits the polygon, including its feather.
Format / format_preset Choice HD (1920x1080) The format used when Output Format is set to Format Preset.
- PC VIDEO (640x480)
- NTSC (720x486:0.91)
- PAL (720x576:1.09)
- NTSC 16:9 (720x486:1.21)
- PAL 16:9 (720x576:1.46)
- QHD (960x540)
- LHD (1280x720)
- HD (1920x1080)
- VHD (1080x1920)
- UHD 4K (3840x2160)
- VUHD 4K (2160x3840)
- UHD 8K (7680x4320)
- Super35 1K FULL AP (1024x778)
- Cinemascope 1K (914x778:2.00)
- Super35 2K FULL AP (2048x1556)
- Cinemascope 2K (1828x1556:2.00)
- DCP 2K (2048x1080)
- Super35 4K FULL AP (4096x3112)
- DCP 4K (4096x2160)
- Square 256 (256x256)
- Square 512 (512x512)
- Square 1K (1024x1024)
- Square 2K (2048x2048)
Format / formatRect Float 4D -500, -500, 500, 500 The rectangle used when Output Format is set to Custom Format, as left, bottom, right and top edges in pixels from the center of the composition.
Pixel Aspect / par Float 1 The pixel aspect ratio of the generated image.
Sides / sides Float 6 Number of sides of the polygon. Fractional values give in-between shapes; at 2 or below, nothing is drawn. See Choosing the Number of Sides.
Offset / offset Float 2D 0, 0 Position of the center of the polygon, in pixels from the center of the composition. Positive Y values move the polygon up.
Radius / radius Float 100 Distance from the center to the corners, in pixels. In Edge Radius mode, this is the outer edge of the outline.
Color / color Color 1, 1, 1, 1 Color and opacity of the polygon.
Colorspace / input_colorspace Choice Project Display Space Only available when the composition's Color Management is set to OpenColorIO. The colorspace in which the colors of this Generator are expressed.
- Project Working Space: The color is assumed to be expressed in the project working space
- Project Display Space: The color is assumed to be expressed in the project display space
Edge Mode / edge_mode Choice None Chooses between a filled polygon, an outline and a gradient. See Filled or Outline.
- None: Draw a filled polygon.
- Distance Field: Fill the polygon with a gradient based on the distance to its sides.
- Edge Radius: Draw an outline by specifying the inner and outer edge radii.
- Thickness: Draw an outline by specifying its radius and the thickness.
- Radius Scaled Thickness: Draw an outline by specifying its radius and the thickness, and scale the thickness by the radius.
- Radius Scaled Thickness & Feather: Draw an outline by specifying its radius and the thickness, and scale the thickness and feather size by the radius.
Thickness / thickness Float 10 Outline thickness, centered on the Radius and measured at the corners. In pixels in Thickness mode, and as a percentage of the Radius in the Radius Scaled modes.
Edge Radius / edge_radius Float 10 Inner edge of the outline, as the distance from the center to the inner corners, in pixels. Only used in Edge Radius mode.
Feather Outer Size / feather_outer_size Float 0 Softness of the outer edge. The feather is centered on the edge. Has no effect in Distance Field mode.
Feather Inner Size / feather_inner_size Float 0 Softness of the inner edge of an outline. Has no effect when Edge Mode is None or Distance Field.
Normalize Distance Field / normalize_df Boolean On In Distance Field mode, when on, the value goes from 1 at the center to 0 on the edges, and below 0 outside. When off, each pixel stores its distance to the nearest side in pixels. See Distance Field.
Roundness Outer / roundness_outer Float 0 Rounds the outer outline, in pixels. The corners stay on the Radius and the sides bulge outward; at a value equal to the Radius, the polygon becomes a circle. Above the Radius, it becomes a pinwheel. See Rounding the Corners and Pinwheels.
Roundness Inner / roundness_inner Float 0 Rounds the inner edge of an outline, in pixels. Above the inner radius, it cuts a pinwheel-shaped hole. Has no effect when Edge Mode is None or Distance Field.
Invert / invert Boolean Off Fills the area outside the polygon instead of the inside. Use with Output Format set to Unbounded to fill the whole frame.
Divisions / divisions Float 1 The number of samples to use for the motion-blur. The higher the number is, the more accurate is the motion-blur when large motion is involved, but the slower it is to render.
Shutter Angle / shutterAngle Float 180 The shutter angle controls the time period over which light can pass. A wider angle increases motion-blur
Shutter Phase / shutterPhaseType Choice Centered - Centered: The shutter opens half the shutter duration before the current time and closes half the shutter duration after
- Start: The shutter opens at the current time and closes after the shutter duration is elapsed
- End: The shutter opens at the current time minus the shutter duration and closes at the current time
- Custom: The shutter opens at the time determined by a custom phase: the phase is an offset on the shutter angle, assuming the shutter opens at 0
Custom Phase / customPhase Float -90 An offset to the shutter angle, assuming the shutter opens at 0: A Shutter angle of 180 with a phase of -90 means that the shutter will be opened half a frame, centered around the current time