Built-in Particles in Blitz3D
Extended mode includes CPU and GPU particle emitters. Start with a constructor and a preset, then adjust the controls your effect needs. GPU particles require the Full product's DX12 renderer.
New to particles? Blitz3D+ Basics: Particle Effects is an animated lesson that starts from the beginning.
Your first effect
fire=CreateParticleEmitter(500) creates an emitter entity. ParticlePreset fire,1 selects fire; presets 2-6 provide smoke, rain, sparks, magic, and dust. Call UpdateWorld and RenderWorld as usual; the default UpdateWorld value advances particles by one 60 Hz tick. Use EmitParticles fire,100 for a one-off burst.
Choosing CPU or GPU simulation
CreateParticleEmitter retains CPU simulation and its existing limits. For GPU simulation, check GPUParticlesSupported() after Graphics3D, then call CreateGPUParticleEmitter(10000). Creation returns 0 on failure; read ParticleError$() for the reason. There is no automatic fallback. ParticleBackend returns 0 for CPU and 1 for GPU; this choice stays fixed.
The GPU constructor defaults to 65536 particles and accepts capacities from 1 to 1048576, subject to memory. This is an allocation bound, not a guaranteed practical count. Large transparent particles can still be expensive to draw; sorting, mesh complexity and multiple views add cost.
Shape and motion
ParticleEmitterShape chooses point (0), box (1), sphere (2), or cone (3) emission. Velocity and per-axis variation come from ParticleVelocity. ParticleGravity, ParticleDrag, and one optional ParticleAttractor shape motion without callbacks or per-particle code.
Appearance
ParticleColor and ParticleSize interpolate over each lifetime. Apply a texture with the normal EntityTexture command. ParticleAnimation divides it into a sprite sheet. Render modes are camera-facing billboard (1), velocity-stretched billboard (2), and batched mesh (3). Emitters alpha blend by default; EntityBlend switches to additive (3) or multiply (2). A new emitter's EntityFX is 1+2+32, which lets ParticleColor tint and fade each particle, so keep those flags when you change it; leave out 32 for solid particles.
GPU mesh particles upload one immutable copy of the first source surface and instance it from GPU state. Freeing the source after ParticleMesh is safe. GPU materials are the default particle material and builtin:soft-particle, with full-bright or emissive FX. Standard lighting, shadows, highlight and other custom shaders are unsupported; soft particles also reject colour overlay and dither coverage. Unsupported configuration raises a runtime error before replacing valid state.
Space, sorting, and collision
World-space particles (the default) remain behind when the emitter moves. Local-space particles follow it. Alpha effects can enable back-to-front sorting with ParticleSort on either backend. Sorting is per emitter and cannot globally order intersecting emitters. GPU sorting retains separate indices for each view. ParticleCollision is CPU-only: it optionally casts each moving particle against a Box3D world; keep collision-enabled counts modest. Use ParticleCollision emitter,0,0,0,0 to disable it. GPU emitters reject a nonzero world.
Timing and counts
UpdateWorld advances simulation independently of rendering. Pause stops automatic births and aging but permits explicit bursts and clear. Hiding an emitter or its ancestor also stops automatic updates; showing it does not catch up missed time. CopyEntity copies settings but starts empty with zero counters and the default seed. GPU random streams differ from CPU streams.
CountParticles and ParticleTotalEmitted are exact and may wait for GPU work. For a HUD use CountParticlesAsync: it returns the latest completed count, or -1 for pending, without waiting. It may lag simulation. RenderInstances, RenderInstancedDraws and RenderTriangles also report -1 when GPU particle counts are pending; display that as pending, not zero.
Ready-to-run samples
CPU samples: Preset Playground, Colliding Sparks, and Mesh Particles.
GPU samples: Rain and Sparks, Soft Particles, and Mesh Particles. All six are self-contained and need no downloads. Each sample lists its working controls on screen.
Authored effects: Flame, smoke and colliding mesh sparks loads the adjacent .world and .particles files. See the particle resource guide for editor authoring, timing, seeds and bindings.