Distributes points very evenly over a sphere by subdividing a platonic solid — the way to scatter copies of an object across a ball with near-uniform spacing (no clustering at the poles).
JavaScript API:
PlatonicSpherePointsSource
This is a procedural 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. The points come from subdividing a platonic
solid and projecting the result onto the sphere, so the coverage stays far more
uniform than a latitude/longitude sk-uv-sphere-points-source — and,
being generated in the shader, a densely subdivided sphere costs the same few
parameters as a coarse one.
Key attributes. solid-type picks the seed polyhedron —
tetrahedron (4 base points), octahedron (6), hexahedron (cube, 8), or
icosahedron (12) — with icosahedron giving the most uniform triangle
distribution and being the usual choice. subdivisions refines the seed: each
step splits every triangle into four, so the point count grows sharply (leave
at 0 for just the solid's own vertices; 2–3 gives a dense, smooth
sphere). radius sets the sphere size and center its position.
Related. For a sphere addressed by rings and segments instead of even
coverage, see sk-uv-sphere-points-source and the general
sk-sphere-points-source; other procedural shapes include
sk-grid-points-source, sk-disc-points-source, and
sk-torus-points-source. For positions taken from data or another object
rather than a formula, see sk-mesh-vertex-points-source,
sk-mesh-surface-points-source, sk-buffer-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.
<!-- Small spheres scattered evenly over a ball. The points come from an
icosahedron subdivided twice (solid-type + subdivisions), then projected
onto a radius-3 sphere — notice how uniform the spacing stays everywhere,
with no crowding at the poles the way a lat/long sphere would show. Raise
subdivisions for a denser shell; switch solid-type to compare seeds. -->
<sk-scene>
<sk-plain-material id="mat" base-color="steelblue"></sk-plain-material>
<sk-cloner mode="vertex">
<sk-platonic-sphere-points-source solid-type="icosahedron"
subdivisions="2" radius="3"></sk-platonic-sphere-points-source>
<!-- Template cloned at each generated point. -->
<sk-sphere radius="0.25">
<sk-surface-paint material="#mat"></sk-surface-paint>
</sk-sphere>
</sk-cloner>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
solid-typeanimatable |
<platonic-solid> ("tetrahedron" | "hexahedron" | "octahedron" | "icosahedron") |
"icosahedron" |
Platonic solid type. |
subdivisions |
<number> |
0 |
Number of subdivision iterations. |
radius |
<number> |
1.0 |
Sphere radius. |
center |
<3d-position> ([<number>, <number>, <number>]) |
[0, 0, 0] |
Sphere center position. |