Displaces every point of a host by a per-point amount that follows a field's weight — translating, scaling, and rotating a cloner's clones, or displacing a mesh or spline's vertices — the general-purpose way to sculpt field-by-field.
JavaScript API:
SimplePointConstraint
This is the general-purpose member of the PointConstraint family: like
every point-constraint it runs a GPU kernel over all of its host's points at once —
the clones of a sk-cloner, or the vertices of a mesh or spline — so it stays
cheap at huge point counts. It samples a SpatialField at each point to get a
weight in [0, 1], then applies animatable transform deltas scaled by that weight —
with no field, the deltas apply at full strength everywhere.
Key attributes. field names the SpatialField to sample by #id. Each
clone is then displaced by animatable deltas scaled by its field weight: translate
dx/dy/dz (added × weight) and scale dsx/dsy/dsz (columns scaled by
1 + delta × weight) are the workhorses. Also available are rotation dh/dp/db
(Euler heading / pitch / bank × weight), position-scale sx/sy/sz (push each
point toward or away from the world origin, or a pivotNode when one is set), and
field-weight-range, which remaps
the raw weight before it scales the deltas. All deltas default to no-effect, so set
only the ones you want — no mapping expressions needed, and every delta is animatable.
On a cloner every delta applies; on a mesh or spline host, whose output carries only
vertex positions, the position deltas (dx/dy/dz, sx/sy/sz) take effect
while the per-clone rotate/scale deltas have no per-vertex slot.
Related. Sibling point-constraints specialise the kernel:
sk-radial-push-point-constraint pushes clones from an origin,
sk-target-at-point-constraint aims each clone at a node, and
sk-custom-wgsl-point-constraint runs an arbitrary WGSL kernel. Its
single-node CPU cousin is sk-field-constraint.
Serve these docs to run the live example.
WebGPU needs a secure context — open this page via grunt serve
rather than double-clicking the file. The Markup tab works from disk.
<!-- One spherical field drives a whole grid of clones through a single
point-constraint: clones near the field centre are pushed UP (dy) AND
swollen (dsx/dsy/dsz), falling back to a flat grid at the edges. The field's
`visualize` markers show the falloff sphere driving it. -->
<sk-scene>
<sk-directional-light p="52deg" h="23deg" intensity="1.0"></sk-directional-light>
<sk-ambient-light intensity="0.4"></sk-ambient-light>
<sk-spherical-gradient-field id="bulge" inner-radius="0" outer-radius="6"
visualize="true"></sk-spherical-gradient-field>
<sk-plain-material id="mat" base-color="#e0a030"></sk-plain-material>
<sk-cloner mode="vertex">
<sk-grid-points-source count-x="14" count-y="1" count-z="14"
spacing-x="0.9" spacing-y="1" spacing-z="0.9"></sk-grid-points-source>
<sk-sphere radius="0.18">
<sk-surface-paint material="#mat"></sk-surface-paint>
</sk-sphere>
<!-- Push up AND swell where the field is strong. -->
<sk-simple-point-constraint field="#bulge" dy="3.5"
dsx="1.6" dsy="1.6" dsz="1.6"></sk-simple-point-constraint>
</sk-cloner>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
fieldanimatable |
<id-ref> |
— | The field providing the per-point weight, as a Field instance. reference by id |
field-weight-rangeanimatable |
<field-weight-range> ([<number>, <number>]) |
— | The [lo, hi] range the field weight maps onto. |
dxanimatable |
<number> |
0 |
Position delta X. |
dyanimatable |
<number> |
0 |
Position delta Y. |
dzanimatable |
<number> |
0 |
Position delta Z. |
dsxanimatable |
<number> |
0 |
Scale delta X — additive: final scale factor = 1 + dsx × weight. |
dsyanimatable |
<number> |
0 |
Scale delta Y — additive: final scale factor = 1 + dsy × weight. |
dszanimatable |
<number> |
0 |
Scale delta Z — additive: final scale factor = 1 + dsz × weight. |
dhanimatable |
<angle> |
0 |
Rotation heading delta in radians. |
dpanimatable |
<angle> |
0 |
Rotation pitch delta in radians. |
dbanimatable |
<angle> |
0 |
Rotation bank delta in radians. |
d-quaternionanimatable |
<quaternion> ({ <number>, <number>, <number>, <number> }) |
— | Rotation delta as quaternion. Slerped by field weight. |