renderAgents.orientedWorld

Agents with a heading, drawn as a shape pointing the way they move (or the way they are turned), colored from a rest color to an excited color.

renderAgents.orientedWorld(layout: WorldSplatLayout & RampResolveLayout, cfg: Omit<OrientedWorldSplatConfig, 'name'> & {
            ramp: Omit<RampResolveConfig, 'name' | 'res' | 'invGain'> & {invGain?: number}
            names: {splat: string; resolve: string}
            /** Give the splat the second resource group as well (a shape family's own resources). */
            extraOnSplat?: boolean
        }): RenderAgentsPipelines

Import sim from shaders/std and use sim.agents.renderAgents.orientedWorld.

heading: 'velocity' reads the direction from the agent's velocity, 'angle' from a stored angle plus a home part. agitation: 'buffer' reads excitement from a per-agent value, 'speed' from the agent's speed. comet: true stretches a glow along the heading. res is the canvas side in texels.

Parameters

NameTypeNotes
layoutWorldSplatLayout & RampResolveLayout
cfg`Omit<OrientedWorldSplatConfig, 'name'> & {
        ramp: Omit<RampResolveConfig, 'name' \| 'res' \| 'invGain'> & {invGain?: number}
        names: {splat: string; resolve: string}
        /** Give the splat the second resource group as well (a shape family's own resources). */
        extraOnSplat?: boolean
    }` |  |

Example

renderAgents.orientedWorld(simLayout, {shape, res: 1024, splatRCap: 16, heading: 'velocity', agitation: 'buffer', comet: true, ramp: {colorSpace: 2, trails: 'on'}, names: {splat: 'boidsSplat', resolve: 'boidsResolve'}})

See also

  • renderAgents.pointWorld — Round motes with no heading, drawn in one tint with a live softness.
  • renderAgents.volume — A 3D swarm seen in perspective: nearer particles draw larger and brighter, and the color runs from rest to excited with speed.

Used by

Boids, MagneticFilings, ParticleFlow