Skip to content

Shape Attributes

Sets per-vertex and per-path attributes on shape data, either from a spatial field or a uniform value. Enables per-path coloring, opacity, and stroke width in DrawShape.

Category: Shape Ops Menu path: Shape Ops > Shape Attributes

Ports

PortTypeDirectionDescription
shape_inshapeinputSource shape
field_inscalarFieldinputSpatial field to sample at each vertex (also accepts vectorField and colorField)
outshapeoutputShape with attributes set

Parameters

ParamTypeDefaultDescription
targetenumColorWhich attribute to write: Color, StrokeWidth, Opacity, Rotation, or Custom
sourceenumFieldField (use field_in or uniform value), Value (always uniform), Tangent (Rotation only — use per-vertex tangent), Index (sample ramp by per-path index)
valuescalar1.0Uniform value (used when source is Field with no connection, or source is Value)
colorValuecolorwhiteColor value (used when target is Color and source is Field/Value)
customAttributestringcustomAttribute key name (used when target is Custom)
tangentOffsetscalar0Degrees added to the computed tangent (only when target=Rotation, source=Tangent)
indexCurveCurveRamp0→1 linearSampled by per-path normalized index for scalar targets (source=Index)
indexColorRampGradientRampblack→whiteSampled by per-path normalized index for Color target (source=Index)
groupAttributestring(empty)Optional path attribute name. When set, paths sharing the same value form a group and share the sampled value — essential for text workflows (use glyphIndex) so multi-contour glyphs stay consistent.
outputMinscalar0Lerp the [0,1] ramp / field output into [outputMin, outputMax]. Hidden for Color target and for source=Tangent or source=Value. Default 0/1 is identity
outputMaxscalar1See outputMin

How It Works

ShapeAttributes evaluates per vertex. For each vertex in the input shape:

  1. If a field is connected to field_in, it is sampled at the vertex's position (origin-centered comp-pixel coordinates).
  2. If no field is connected, the value or colorValue param is used uniformly for all vertices.

Attributes are written at two levels:

  • Per-vertex (shape.points.attributes) -- used by DrawShape's per-vertex color pipeline for smooth GPU-interpolated gradients across triangles.
  • Per-path (path.attributes, using the first vertex's value) -- used by DrawShape's grouped rendering for per-path color, opacity, and stroke width.
TargetAttribute keyEffect in DrawShape
ColorcolorPer-vertex: smooth GPU-interpolated gradients. Per-path: uniform path color.
StrokeWidthstrokeWidthMultiplier on DrawShape's strokeWidth param per path
OpacityopacityPer-path alpha multiplier
Customuser-definedAvailable for custom pipelines (consumer nodes decide what to do)

Custom target output type: The Custom target follows the field type of the connected input:

  • ColorField -> Vec4 per vertex (and per path, from first vertex)
  • VectorField (alone) -> Vec2 per vertex (bipolar [-1,1])
  • ScalarField or uniform value -> Scalar per vertex

This mirrors PointAttributes' Custom target, so the same convention applies across points and shape vertices.

DrawShape rendering priority: When per-vertex color attributes are present, DrawShape automatically uses its DrawShapeVertexColor pipeline for smooth gradient fills. When only per-path attributes exist, it uses grouped rendering (one draw call per unique color/opacity/strokeWidth group). When neither is set, it uses a single uniform-color draw call.

Usage Examples

Basic: Gradient-colored shape

Rectangle -> SubdivideShape (gridSize: 10) -> ShapeAttributes (target: Color, field: Gradient.colorField) -> DrawShape. The rectangle fills with a smooth color gradient interpolated across its subdivided mesh.

Per-path stroke width

Grid -> CloneToPoints (shape: Circle) -> ShapeAttributes (target: StrokeWidth, field: Noise.scalarField) -> DrawShape. Each cloned circle gets a different stroke width based on its position in the noise field.

Opacity fade

EditableShape -> ShapeAttributes (target: Opacity, field: DistanceField.scalarField) -> DrawShape. Parts of the shape closer to another shape fade out.

Per-letter text coloring (Index source + glyphIndex grouping)

Text("HELLO") -> TextToShape -> ShapeAttributes (target: Color, source: Index, groupAttribute: "glyphIndex", indexColorRamp: red->blue) -> DrawShape. Each letter gets a distinct color sampled along the ramp; multi-contour glyphs like "O" keep their outer and inner paths the same color thanks to glyphIndex grouping.

Per-path progressive stroke width

A shape with N paths -> ShapeAttributes (target: StrokeWidth, source: Index, indexCurve: 0 -> 2). The first path has strokeWidth multiplier 0, the last has 2, linearly.

Tips

  • For smooth color gradients, the shape needs interior vertices -- use SubdivideShape upstream to create a mesh with enough resolution for the gradient
  • StrokeWidth is a multiplier on DrawShape's strokeWidth param, not an absolute value -- a value of 2.0 doubles the base stroke width
  • ShapeAttributes does not change vertex positions -- it only writes attribute data. Use ShapeDeform for position changes.
  • You can chain multiple ShapeAttributes nodes for different targets (e.g., one for Color, another for StrokeWidth)
  • PointAttributes -- same concept for points instead of shape vertices
  • SubdivideShape -- create interior mesh vertices for smooth per-vertex gradients
  • DrawShape -- reads color, strokeWidth, and opacity attributes
  • CloneToPoints -- creates multi-path shapes ideal for per-path attributes
  • Gradient -- colorField source for spatial color mapping
  • DistanceField -- scalarField source for proximity-based attributes

Caddis — professional motion design.