<sk-compute-buffer-points-source>

← prev index next →

Places clones at per-point transforms a GPU compute pass writes into a buffer — the way to drive a cloner from positions computed on the GPU each frame (a physics step, a flocking simulation, a compute-shader layout).

Remarks

This is a data-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 generate their points from a formula — this one takes its placements from a sk-compute-node: the cloner binds the producer's GPU buffer slice directly (zero-copy, nothing read back to the CPU), so the layout can be regenerated on the GPU every frame at no transfer cost.

Key attributes. compute-node references (by #id) the sk-compute-node whose output supplies the placements; that node must be declared with output-kind="point-matrices" so it emits PointData records (one local matrix per point). compute-property-key selects which output to read when a node exposes several — it defaults to output.0, so a single-output producer needs no key. The source stays inert (zero points) until the referenced producer is resolved and GPU-ready.

Related. For placements written as a per-index function instead of a compute pass, see sk-custom-wgsl-points-source; both pair naturally with a sk-compute-node. For object/data-driven placements see sk-mesh-vertex-points-source, sk-mesh-surface-points-source, sk-buffer-points-source, and 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.

Attributes

AttributeTypeDefaultDescription
id <id> The element's unique identifier — the standard HTML global id attribute.
compute-nodeanimatable <id-ref> The producing compute node (instance, wired at connect via its id). reference by id
compute-property-key <property-name> "output.0" The output key to read (output.N).