rift_motes.computeShader
One step of the arcane mote swarm, run as a `sim.shader` solver with a neighbour grid. Motes swirl around the rift through a rolling vortex ring stirred by turbulence, and keep apart through grid-based separation, so the swarm streams together with its motes kept apart. It runs o…
rift_motes
One step of the arcane mote swarm, run as a sim.shader solver with a neighbour grid. Motes swirl
around the rift through a rolling vortex ring stirred by turbulence, and keep apart through
grid-based separation, so the swarm streams together with its motes kept apart. It runs one
invocation per mote in workgroups of 64.
For each mote the shader builds a desired velocity from four parts:
- a swirl around the vertical axis through the origin,
swirl * (0.45 + 1.4 * exp(-0.35 * rho)), fastest near the axis; - a poloidal roll around the ring core at radius
coreRand heightcoreH: up on the inside, out over the top, down at the outer edge, at a rate set byrollRate; - a smooth turbulence from summed sines of position and time;
- a pull back toward the ring core for any mote farther than
shellfrom it, and a lift for any mote below height 0.2.
It then visits every mote in the 27 grid cells around it and adds a push away from each neighbour
closer than radius, weighted by (1 - distance / radius)^2. The velocity eases toward the desired
one at a rate of 1 - exp(-1.6 * dt), takes the push times separate * dt, is capped at 4.5 units
per second, and moves the mote by velocity * dt.
Bindings
| Binding | Access | What it holds |
|---|---|---|
P | read_write | Positions, three floats per mote; the shader writes the new position. |
prev_P | read | Positions at the start of the step, read for the mote itself and for its neighbours. |
v | read_write | Velocities, three floats per mote; read and written back. |
gcfg | read | Grid configuration, used by zero_grid_cell and zero_grid_range. |
grange | read | Per-cell ranges into gorder, used by zero_grid_range. |
gorder | read | Mote indices sorted by grid cell; the separation loop reads neighbours from it. |
The grid helpers come from #include "@builtin::systems.procgen.grid".
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
count | int | 0 | Number of motes. |
dt | float | 0.0166667 | Step length in seconds. |
time | float | 0.0 | Solver time in seconds; drives the turbulence. |
radius | float | 0.35 | Separation radius. |
separate | float | 7.0 | Strength of the separation push. |
coreR | float | 2.8 | Radius of the vortex ring's core from the vertical axis. |
coreH | float | 1.9 | Height of the vortex ring's core. |
shell | float | 3.2 | Distance from the ring core beyond which motes are pulled back. |
swirl | float | 1.7 | Speed of the swirl around the vertical axis. |
rollRate | float | 0.45 | Rate of the poloidal roll. |
Dispatch
The arcane_rift graph (rift/arcane_rift.procGraph) dispatches it from its swarm node, a
sim.shader over 900 points seeded in a cylinder of radius 4.2 and height 3.4, with a v (Vec3)
attribute, neighborRadius 0.75 and uniforms radius 0.75, separate 5, coreR 2.5, coreH 1.7,
shell 1.9, swirl 1.5 and rollRate 0.5. Each of those 900 leaders is drawn as a cluster of
eight motes by rift_mote_cluster. In the Procgen Effects Showcase world, the fx_rift scene plays the graph.
Scoped to this part · feeds back into the world's score.