Three.js From Zero · Article s17-06
Chladni Plates — Sand That Flees to the Silence
12,000 grains random-walk on a vibrating plate and assemble the classic Chladni figures: closed-form fields with hand-derived gradients, order-from-noise transport, and when NOT to use the GPU. Part of the MasterAllArts Creative 3D Roadmap.
Part of the MasterAllArts Creative 3D Roadmap .
Season 17 · Article 06 · Order & Chaos
In 1787, Ernst Chladni bowed the edge of a brass plate dusted with sand and watched the grains arrange themselves into star-and-lattice figures no one had ever drawn. The trick: a vibrating plate has lines that don't move — nodes — and sand, kicked mercilessly everywhere else, random-walks until it stumbles onto the quiet and stays. Twelve thousand grains, two mode numbers, and the most counterintuitive idea in this season: noise is what builds the pattern.
Orbit low across the plate — the grains over the loud regions hop (their height is the local vibration amplitude) while the settled node-lines lie flat and bright. Change n or m and the old figure dissolves mid-air, then a new one assembles in a second or two. Tick − mix to switch the two great symmetry families. shuffle deals a random chord; pour sand re-scatters the grains without changing the music.
The plate that draws its own music
A vibrating square plate rings in modes — standing-wave patterns indexed by two integers. The classic approximation for the figure (n, m) is one line of trig:
f(u, v) = cos(nπu)·cos(mπv) ± cos(mπu)·cos(nπv) // u, v ∈ [0, 1]
The nodal lines are wherever f = 0 — points that stand still while everything
around them shakes. The ± chooses how the two mirror-modes superpose: + gives patterns
symmetric across the diagonals, − gives patterns symmetric across the center lines. (This
plate problem is also a heroine's tale: the Paris Academy offered a prize for its theory,
and Sophie Germain — barred from lectures for being a woman — won it in 1816.)
Step 1 — An analytic field and its honest gradient
Unlike Physarum (agents wrote the field) or the Ising lattice (the field was the state), this field is closed-form — so its slope is too. Differentiate by hand once, and every particle gets an exact compass for free:
function field(u, v) { return cos(nPI*u)*cos(mPI*v) + sign*cos(mPI*u)*cos(nPI*v); }
function gradU(u, v) { return -nPI*sin(nPI*u)*cos(mPI*v) - sign*mPI*sin(mPI*u)*cos(nPI*v); }
// gradV is the mirror image
No numerical differencing, no texture sampling — just trig. When your field has a formula, use the formula; the derivative is one chain rule away and it's exact everywhere.
Step 2 — The transport rule: noise pushes, gradient pulls
Real sand doesn't know calculus. It gets thrown upward wherever the plate moves, lands slightly elsewhere, and the only resting places are where the throwing never happens. The simulation distills that into two terms, both scaled by the local amplitude |f|:
const a = Math.abs(field(u, v)); // how hard the plate shakes here
u += (-Math.sign(f) * gradU(u, v) * PULL * a // drift downhill on |f|
+ (Math.random() - 0.5) * KICK * a) * dt; // and get kicked at random
Look at the structure: both the orderly term and the random term vanish at the nodes. A grain at a node feels nothing and stays forever; a grain anywhere else gets pushed and shaken until it isn't anywhere else. The pattern is not built by attraction — it is built by everywhere-else being uninhabitable. Order from noise: the season's thesis in one update rule.
Step 3 — When NOT to use the GPU
After five GPU articles in a row, a deliberate counterexample. Twelve thousand particles × a dozen trig calls each = ~150k flops per frame — JavaScript eats that in well under a millisecond. Moving this to a GPGPU texture pipeline would cost you the readback for the bounce heights, the debugging visibility, and an hour of plumbing, to optimize something that was never slow.
Points buffer is simpler, debuggable, and just as fast. Profile before you
pipeline.
Step 4 — The bounce: reading amplitude in 3D
positions[i * 3 + 1] = a * BOUNCE * Math.random(); // grain height = local loudness
One line turns the third dimension into an instrument readout. Looking across the plate at a low angle you see the standing wave itself — a fuzz of leaping grains shaped like the anti-node hills — while the nodal figure lies flat and crisp beneath. Grain color follows the same scalar (settled = warm, flying = dim violet), the series' color-is-data pattern doing its quiet work.
What the controls teach
- n = m — the degenerate diagonal: with + mix the field collapses to a product, and you get a pure grid of squares.
- adjacent numbers (3,4 / 5,6) — the famous swooping curves; far-apart numbers (1,7) — fine combs inside coarse frames.
- − mix — same two numbers, different superposition, completely different family. Interference, not ingredients, decides the figure.
- vibration — scales the kicks: too low and grains freeze before reaching a node (a glass, not a crystal); too high and the figure stays smoky. There's an annealing sweet spot — Metropolis fans will recognize the temperature analogy.
The skeleton
<script type="importmap">
{ "imports": {
"three": "https://unpkg.com/three@0.170.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.170.0/examples/jsm/" } }
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// closed-form field + hand-derived gradient (Step 1)
// per grain: amplitude-scaled pull + kick (Step 2)
// CPU arrays → one Points buffer (no GPGPU needed) (Step 3)
// grain height = |f| → the wave made visible (Step 4)
</script>
Next: S17-07 — The Superformula. One equation with six knobs that morphs through starfish, diatoms, flowers, and shells — and how to turn any parametric surface into a live, morphing BufferGeometry.