Skip to content

Particles

Particles in vgai are powered by three.quarks. All systems share a single BatchedRenderer so they draw efficiently (packages/engine/src/setup/setup-particles.ts).

An emitter shape spawns particles, behaviors modify them over life, a render mode draws them
Emitter → behaviors → render mode.

Setup creates one BatchedRenderer, adds it to the scene, and it’s ticked with batchedRenderer.update(dt) in the preRender phase. Add your particle systems to the batched renderer (not directly to the scene) so they batch together.

A system spawns particles from an emitter shape: point, sphere, hemisphere, cone, circle, donut, rectangle, or grid.

Behaviors modify particles as they age. The factory wires these three.quarks behaviors:

ApplyForce, ColorOverLife, SizeOverLife, SpeedOverLife, RotationOverLife, ForceOverLife, OrbitOverLife, Noise, TurbulenceField, FrameOverLife, LimitSpeedOverLife, ChangeEmitDirection, GravityForce, WidthOverLength.

How each particle is drawn: billboard, stretchedBillboard, mesh, trail, horizontalBillboard, verticalBillboard.