renderAgents
How the agents are drawn, as one declared part: a splat (each agent stamps its shape into a shared canvas) paired with the matching resolve (the canvas becomes the output picture).
renderAgents: { orientedWorld, pointWorld, volume, relief }
Import sim from shaders/std and use sim.agents.renderAgents.
Four variants, one per kind of agent: orientedWorld for agents with a heading (arrows, streaks, comets) colored from rest to excited, pointWorld for round motes in one tint, volume for a 3D swarm seen in perspective, relief for particles that stand on an image. Put the returned splat and resolve into bake's pipelines and end the program with them.
Example
const render = renderAgents.orientedWorld(simLayout, {shape: 'arrow', res: 1024, splatRCap: 16, heading: 'velocity', agitation: 'buffer', comet: true, ramp: {colorSpace: 2, trails: 'on'}, names: {splat: 'boidsSplat', resolve: 'boidsResolve'}})
Tip. The resolve also clears the canvas as it reads it, so no clear step is needed.
Members
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.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.renderAgents.relief— Particles standing on an image, seen through a camera: each carries the child's color at its home, and nearer particles win the color where they overlap.
See also
agentSim— A simulation of many agents, spread into a definition:bakeassembles the steps from your declared parts,framewrites the per-frame values, and the fragment samples the picture.op.splat— A brush step: a soft round push into the grid at the pointer, scaled by how fast it moves.resolve— The step that turns the shared canvas into the output picture and clears it for the next frame.pointSlot— The three parts a round mote is drawn with: where it sits (orbitalPlace), how bright it is (twinkleBrightness) and how big it is (presenceRadius).
Used by
Boids, FloatingParticles, MagneticFilings, ParticleField, ParticleFlow, Particles