Renderer · interface
ParticleBatchOptions
Explained in Hello world.
interface ParticleBatchOptionsimport type { ParticleBatchOptions } from '@driftengine/core';Properties
| Name | Type | Description |
|---|---|---|
material | ParticleMaterial | Which particle this is, by name.MoreThis replaced a GLSL source string on 2026-08-13, the same change and for the same
reason as |
blend | ParticleBlend | |
stretchSecoptional | number | Seconds of travel a particle is stretched along. 0 for smoke.MoreThe velocity it stretches along is a direction to be drawn on, not a motion being simulated, and it must stay that way. Nothing here integrates it: a caller writes both position and velocity every frame, so a deterministic consumer that computes where a particle is from its own plan can still ask for the streak that a moving thing has. That is load-bearing outside this repository, where a corona's streamers are the spark material stretched radially and nothing about them moves. Advancing position from this would take the feature away from every caller that is not running a simulation. |
erosionoptional | number | How hard the noise erodes a puff, 0 to 1. Ignored by the spark and mote materials. |
coreGainoptional | number | How far past white a spark's core may go. Ignored by the smoke and mote materials. |
fogoptional | boolean | Whether the medium's fog and underwater tint reach this pool. Ignored by the spark and
smoke materials, which stay unconditionally fogged — a real ember and real grit belong in
the same haze as the rest of the world, matching every particle drawn before this option
existed. Defaults to false, because a caller reaching for 'mote' over 'spark'/'smoke'
is usually asking for exactly what those two cannot draw: an unlit point exactly its own
colour, untouched by distance. See PARTICLE_MOTE_FRAG's own comment on uFogEnabled. |
facingoptional | ParticleFacing | Whether each particle is one camera-facing quad or a world-fixed cross of two.MoreDefaults to |
textureoptional | SurfaceTexture | The image a 'sprite' draws: a surface texture, its first layer. Required by the sprite and
ignored by the procedural materials. Colour is the particle's times the image's, unlit. |
cellsoptional | readonly [number, number] | A 'sprite''s flipbook: the image as [columns, rows] cells, numbered across then down from
the top-left, a particle's frames naming one. [1, 1], the default, is the whole image. |
blendCellsoptional | boolean | Whether a 'sprite' blends from a particle's cell toward the next by the fraction of its
frame, so a slow flipbook moves rather than steps. Off by default: one cell, sampled once. |
softDepthoptional | number | Metres over which a 'sprite' fades where it meets the opaque scene: the hard line a flat card
draws where it cuts a floor or a body, softened. 0, the default, is a hard edge. It reads a
copy of the frame's depth, which needs screenEffects; without one the edge stays hard and
the renderer says so once. |
cameraFadeoptional | number | Metres in front of the eye over which a 'sprite' fades in. 0, the default, is no fade. |
cameraOffsetoptional | number | Metres each particle is moved toward the eye before it is drawn, so a sprite born inside a surface is drawn in front of it. 0 by default. Every material reads it. |
sortoptional | boolean | Whether the live particles are drawn farthest first, the order an alpha blend assumes. Off
by default, because sorting costs a pass over the particles on the CPU each frame and an
additive blend is a sum that does not care. See particleSort.ts. |
reuseoptional | ParticleBatch | Another batch whose compiled program this one should reuse.MoreSeveral pools legitimately share a material while needing their own buffers — a game may have four kinds of smoke, each with its own colours, lifetime and capacity, all drawn by one fragment shader. Without this each of them compiles the same source again, which is pure boot time on the device where boot time is scarcest. The per-material constants stay per batch, because they are the point of having several. Only valid for the same |