Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

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 coreR and height coreH: up on the inside, out over the top, down at the outer edge, at a rate set by rollRate;
  • a smooth turbulence from summed sines of position and time;
  • a pull back toward the ring core for any mote farther than shell from 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

BindingAccessWhat it holds
Pread_writePositions, three floats per mote; the shader writes the new position.
prev_PreadPositions at the start of the step, read for the mote itself and for its neighbours.
vread_writeVelocities, three floats per mote; read and written back.
gcfgreadGrid configuration, used by zero_grid_cell and zero_grid_range.
grangereadPer-cell ranges into gorder, used by zero_grid_range.
gorderreadMote indices sorted by grid cell; the separation loop reads neighbours from it.

The grid helpers come from #include "@builtin::systems.procgen.grid".

Parameters

ParameterTypeDefaultMeaning
countint0Number of motes.
dtfloat0.0166667Step length in seconds.
timefloat0.0Solver time in seconds; drives the turbulence.
radiusfloat0.35Separation radius.
separatefloat7.0Strength of the separation push.
coreRfloat2.8Radius of the vortex ring's core from the vertical axis.
coreHfloat1.9Height of the vortex ring's core.
shellfloat3.2Distance from the ring core beyond which motes are pulled back.
swirlfloat1.7Speed of the swirl around the vertical axis.
rollRatefloat0.45Rate 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.