Polygon
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:
- Triangles, hexagons and other simple graphic elements, badges and icons
- Animated outlines, pulses and shapes that morph from one polygon to another
- Rounded shapes halfway between a polygon and a circle
- Polygonal masks, mattes and gradients
Quick Navigation
- Creating and Connecting a Polygon
- Choosing the Number of Sides
- Filled or Outline: the Edge Mode
- Keeping Proportions with the Radius Scaled Modes
- Rounding the Corners
- Pinwheels: Roundness Above the Radius
- Soft Edges with Feather
- Inverting the Polygon
- Distance Field
- Fitting the Polygon in a Format
- Motion Blur
- Controls
Creating and Connecting a Polygon
Like any Image Generator, the Polygon can be connected to any image parameter, for example:
- The Source of a layer, to display the polygon itself
- The Mask of a layer, to reveal that layer through a polygonal shape
- The image input of a Modifier, for example to use the polygon as a matte or a map that drives an effect
The quickest way to create a layer with a Polygon as its source is described in Adding Layers:
- Click the + button at the top of the layer stack and choose Polygon from the list of Generators
- Place the mouse cursor over the Viewer and open the Quick Access Menu, then pick Polygon:
- Press Q when no layer is selected
- Press Shift+Q when a layer is selected (in this case, Q opens the menu dedicated to Modifiers)
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.
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.
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.
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:
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.
- None: draws a filled polygon of the given Radius
- Distance Field: fills the polygon with a gradient based on the distance to its nearest side, full color at the center and transparent at the edges. See Distance Field below.
- Edge Radius: draws an outline between two polygons. Radius is the outer edge and Edge Radius is the inner edge, both measured from the center to the corners. A Radius of 170 with an Edge Radius of 110 gives an outline 60 pixels wide at the corners. Use it when you need exact inner and outer sizes, for example to fit an outline around another element.
- Thickness: draws an outline of the given Thickness, centered on the Radius. Half of the outline is drawn outside the Radius and half inside, so a Radius of 170 with a Thickness of 40 covers the area between 150 and 190 pixels from the center, measured at the corners.
- Radius Scaled Thickness: draws an outline like Thickness, but the Thickness is a percentage of the Radius, so the outline keeps its proportions when the Radius changes. See Keeping Proportions with the Radius Scaled Modes.
- Radius Scaled Thickness & Feather: same as Radius Scaled Thickness, and the Feather sizes are scaled too.
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.
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.
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.
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:
- At 0 (the default), the corners are sharp.
- When Roundness Outer equals the Radius, the polygon becomes a perfect circle of that radius.
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.
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.
- The number of blades follows Sides. The fewer the sides, the larger the blades: on a triangle, they quickly reach far beyond the Radius.
- In the outline modes, the outer edge takes the pinwheel shape, while the inner edge stays a polygon.
- Roundness Inner works the same way on the inner edge: above the inner radius, it cuts a pinwheel-shaped hole into the outline, like a camera iris.
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:
Soft Edges with Feather
Two parameters soften the edges of the polygon:
- Feather Outer Size softens the outer edge
- Feather Inner Size softens the inner edge of an outline
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.
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:
- With Auto (the default), the image is only as large as the polygon itself, including its feather. When inverted, only this square is filled, and the color stops at its border.
- With Unbounded, the image has no limits, and the inverted area fills the whole frame.
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:
- On (the default): the value goes from 1 at the center to 0 on the edges of the polygon, whatever its size, and the Color is applied on top.
- Off: each pixel stores its actual distance to the nearest side, in pixels, in all four channels. On a hexagon with a Radius of 200, the values go from 0 on the edges up to about 173 at the center, which is the distance from the center to the middle of a side.
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:
- With Auto (the default), the image is only as large as the polygon, so the negative values fill a square around it.
- With Unbounded, the negative values cover the whole frame.
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.
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.
- Composition Format: a polygon stretched to the composition
- Format Preset: a polygon stretched to the selected preset, such as Square 512
- Custom Format: a polygon stretched to the rectangle you define with the Format parameter (left, bottom, right, top, in pixels from the center of the composition)
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 |
