Resample Shape
Resamples shape paths at uniform arc-length intervals, producing either polylines or fitted bezier curves. Useful as preparation for deformation or attribute assignment.
Category: Shape Ops Menu path: Shape Ops > ResampleShape
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
shape_in | shape | input | Shape to resample |
out | shape | output | Resampled shape |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
mode | enum | count | count (fixed number of points) or spacing (fixed distance between points) |
count | scalar | 32 | Number of points per path (when mode is count) |
spacing | scalar | 10 | Distance in pixels between points (when mode is spacing) |
resampleType | enum | linear | Output type: linear (polyline segments) or bezier (centripetal Catmull-Rom cubic fit — handles stay close to the chord, no overshoot) |
How It Works
ResampleShape walks each path in the input shape at uniform arc-length intervals and places new vertices at regular positions along the curve. The original vertex structure is replaced with evenly distributed points.
Mode controls how many points are generated:
- count -- each path gets exactly
countpoints, regardless of path length - spacing -- points are placed every
spacingpixels along the arc length, so longer paths get more points
Resample type controls the output geometry:
- linear -- straight line segments between samples, producing a polyline. Fast and predictable.
- bezier -- fits centripetal Catmull-Rom cubic bezier curves through the sampled positions, producing smooth curves that closely approximate the original shape. Centripetal parameterization (α = 0.5) is the industry default — it scales each tangent by
sqrt(chord_length)so handles never loop past the segment endpoints, eliminating the "wrinkle" artifacts that uniform Catmull-Rom produces on paths with sharp turns or uneven chord lengths.
Open and closed paths are preserved. Closed paths distribute points around the full perimeter.
Usage Examples
Basic: Prepare for deformation
Rectangle -> ResampleShape (count: 64) -> ShapeDeform -> DrawShape. A Rectangle has only 4 vertices, which produces coarse deformation. Resampling to 64 points gives ShapeDeform enough vertices for smooth displacement.
Even spacing for attributes
Circle -> ResampleShape (mode: spacing, spacing: 5) -> ShapeAttributes (target: Color, field: Noise) -> DrawShape. Uniform spacing ensures consistent attribute sampling density along the path.
Polyline conversion
EditableShape -> ResampleShape (resampleType: linear, count: 100) -> ShapeToPoints. Convert a bezier curve to a polyline with a known number of vertices, then extract as points.
Tips
- Higher
countor lowerspacingproduces more vertices -- this increases tessellation cost in DrawShape but gives smoother deformation results - Use
lineartype when you need predictable vertex positions (e.g., for ShapeToPoints extraction) - Use
beziertype when the resampled shape will be rendered directly and needs to look smooth with fewer points - ResampleShape runs in the value pre-pass for accurate bounds computation
Related Nodes
- ShapeDeform -- per-vertex displacement (benefits from resampled input)
- ShapeAttributes -- per-vertex attribute assignment (benefits from uniform spacing)
- SubdivideShape -- fills interior with triangles (different purpose: area fill vs. path resampling)
- ShapeToPoints -- extract resampled vertices as a point cloud