Subdivide Shape
Fills the interior of closed shapes with a Delaunay-triangulated mesh. Designed for smooth per-vertex color gradients via ShapeAttributes.
Category: Shape Ops Menu path: Shape Ops > SubdivideShape
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
shape_in | shape | input | Shape to subdivide |
out | shape | output | Shape with interior mesh |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
gridSize | scalar | 20 | Approximate spacing in pixels between interior mesh vertices (minimum 5px, 50K triangle cap) |
How It Works
SubdivideShape takes closed paths and fills their interiors with a dense triangle mesh using Delaunay triangulation. The process:
- Resamples the boundary at the
gridSizeinterval - Generates a hex-packed interior point grid
- Filters interior points using point-in-polygon testing
- Runs Delaunay triangulation on all boundary + interior points
- Outputs the resulting mesh as shape paths (one triangle per path)
The output is a shape with many small triangular paths covering the interior. When combined with ShapeAttributes and a field source (Gradient, Noise, DistanceField), each triangle vertex gets its own color, and DrawShape's per-vertex color pipeline renders smooth GPU-interpolated gradients across the surface.
Open paths pass through unchanged. The triangle count is capped at 50,000 to prevent runaway computation.
Usage Examples
Basic: Shape with gradient fill
Rectangle -> SubdivideShape (gridSize: 15) -> ShapeAttributes (target: Color, field: Gradient.colorField) -> DrawShape. The rectangle is filled with a smooth color gradient that follows the Gradient node's spatial mapping.
Distance-based coloring
Circle -> SubdivideShape -> ShapeAttributes (target: Color, field: DistanceField.colorField) -> DrawShape. Colors vary smoothly from the shape's boundary inward, driven by the signed distance field.
Animated noise colors
Rectangle -> SubdivideShape -> ShapeAttributes (target: Color, field: Noise.scalarField) -> Colorize -> DrawShape. Noise drives per-vertex luminance, Colorize maps it through a color ramp. Animate Noise evolution for shifting colors.
Tips
- Smaller
gridSizeproduces denser meshes with smoother gradients but higher triangle count - Only closed paths are subdivided -- open paths pass through as-is
- SubdivideShape is specifically designed for the per-vertex color pipeline in DrawShape. Without ShapeAttributes assigning per-vertex color, the triangles will all render the same uniform color.
- The 50K triangle cap prevents performance issues. If you hit the cap, increase
gridSize. - For per-path (not per-vertex) coloring, you don't need SubdivideShape -- use CloneToPoints with ShapeAttributes instead
Related Nodes
- ShapeAttributes -- assigns per-vertex colors from fields onto the subdivided mesh
- DrawShape -- renders the per-vertex color mesh with GPU interpolation
- ResampleShape -- resamples paths along their arc length (different from interior subdivision)
- DistanceField -- SDF field source for distance-based vertex coloring