<sk-grid-points-source>

← prev index next →

Lays out points on a regular 3D lattice centred at the origin — the way to array copies of an object in even rows, on a plane, or through a filled volume.

Remarks

This is the lattice member of the points-source family: 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 that gets cloned at each grid point. Because the positions are generated procedurally in the shader (see ShaderFunctionPointsSource), a million-point grid costs the same handful of parameters as a hundred-point one.

Key attributes. count-x / count-y / count-z set how many points lie along each axis — the total is their product, and setting one count to 1 collapses that axis to give a line (two 1s) or a plane (one 1) instead of a volume. spacing-x / spacing-y / spacing-z set the gap between adjacent points on each axis, so the grid's extent on an axis is (count − 1) × spacing. The lattice is always auto-centred on the origin, so growing the counts expands it symmetrically. normal-direction is the shared surface normal reported for every point; a cloner with align-to-normal turns each clone to face it (so the whole field leans together), and it otherwise stays at the default up vector.

Related. It sits alongside the surface sources — sk-sphere-points-source, sk-disc-points-source, sk-plane-points-source, sk-cube-points-source, and the rest — as the volumetric member of the family; sk-plane-points-source is the dedicated 2D counterpart. For points that come from data or another object rather than a formula, see sk-buffer-points-source, sk-mesh-vertex-points-source, and sk-cloner-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
count-x <number> 1 Number of points along the X axis.
count-y <number> 1 Number of points along the Y axis.
count-z <number> 1 Number of points along the Z axis.
spacing-x <number> 1 Distance between adjacent points along the X axis.
spacing-y <number> 1 Distance between adjacent points along the Y axis.
spacing-z <number> 1 Distance between adjacent points along the Z axis.
normal-direction <3d-vector> ([<number>, <number>, <number>]) [0, 1, 0] Normal direction for all points.