Places one clone at every vertex of a mesh — the way to snap copies of an object exactly onto another shape's points, so the clones trace that shape's wireframe geometry.
JavaScript API:
MeshVertexPointsSource
This is a mesh-driven member of the points-source family (see
ShaderFunctionPointsSource): a points-source defines the set of
positions at which a sk-cloner places copies of its content, so it lives
as a child of a <sk-cloner> and the cloner's other child is the template
cloned at each point. Unlike the procedural sources — which compute their points
from a formula — this one reads its positions from an existing
sk-mesh (or any geometry primitive), one point per vertex, and uses each
vertex normal to orient the clone. It follows the referenced mesh live: when the
mesh regenerates, the clone set updates to match.
Key attributes. mesh references (by #id) the mesh whose vertices become
the points; the referenced element is the geometry source, not something drawn
at those points. deduplicate (on by default) merges vertices that share a
position — meshes split a shared corner into several vertices with different
normals to render hard edges, so without merging you would get several clones
stacked at every such corner; the merged clone takes the averaged normal. Turn
it off to place a clone at every raw vertex.
Related. To scatter clones across a mesh's surface (rather than exactly on
its vertices), see sk-mesh-surface-points-source. For placements from an
explicit buffer see sk-buffer-points-source; from the GPU see
sk-compute-buffer-points-source and
sk-custom-wgsl-points-source; from another cloner see
sk-cloner-points-source. For built-in procedural shapes see
sk-grid-points-source and sk-sphere-points-source. Its host is
always a sk-cloner.
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.
<!-- Little spheres snapped exactly onto another shape's vertices. The points
source references the coarse host sphere by id (mesh="#host"); the cloner
then drops a small sphere at each of its vertices, so the clones trace out
the host's low-segment geometry. The host itself is hidden — only its
vertex positions are used. Raise the host's segments for more points. -->
<sk-scene>
<sk-plain-material id="mat" base-color="steelblue"></sk-plain-material>
<sk-cloner mode="vertex">
<sk-mesh-vertex-points-source mesh="#host"></sk-mesh-vertex-points-source>
<!-- Template cloned at each host vertex. -->
<sk-sphere radius="0.25">
<sk-surface-paint material="#mat"></sk-surface-paint>
</sk-sphere>
</sk-cloner>
<!-- The host mesh whose vertices drive the cloner (hidden; only its points are used). -->
<sk-sphere id="host" radius="3" segments="2" style="content-visibility: hidden"></sk-sphere>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
id |
<id> |
— | The element's unique identifier — the standard HTML global id attribute. |
meshrequiredanimatable |
<id-ref> |
— | The source mesh INSTANCE for the imperative path. reference by id |
deduplicate |
<boolean> |
true |
Whether to deduplicate vertices that share the same position. |