Sort type selection¶
Sorting Type on a ParticleEmitter decides whether (and how) particles are sorted before drawing. The choice is almost always driven by the blend mode of the assigned Particle Material; sorting cost is a secondary consideration.
The four options¶
IdentitySpawn-order draw. No per-frame sort cost. The index buffer is allocated once with identity mapping and reused every frame. Default.
DepthPer-frame back-to-front GPU sort by distance to the sorting camera. Required for correct alpha blending of transparent particles: without it, particles draw in arbitrary order and transparency goes wrong at overlaps.
Reverse DepthPer-frame front-to-back GPU sort. Cheaper than
Depthfor opaque particles because early-z rejects fragments hidden behind already-drawn particles. Incorrect for transparent materials.UnsortedNo index buffer is allocated. Saves the per-emitter memory cost of an index buffer. The assigned
ParticleMaterialmust not referenceSortingIndicesBuffer, or drawing will crash.
Picking by blend mode¶
Material blend |
Sort type |
Why |
|---|---|---|
Transparent (alpha-blended) |
|
Back-to-front is the only order that composes correctly under alpha blending. |
Additive |
|
Additive blending is commutative; order does not affect the result. |
Opaque (alpha-tested) |
|
Front-to-back maximises early-z rejection. |
Subtractive or other non-commutative blends |
|
Treat as transparent-style; order matters. |
Cost¶
Sort dispatches are indirect: the per-frame workgroup count is derived from the active particle count, not MaximumAmount. An emitter with MaximumAmount = 50000 and 5k live particles pays a 5k-element sort, not a 50k one. The cost of Depth / Reverse Depth is therefore real but scales with what is actually on screen.
MaximumAmount still matters for a sorted emitter’s memory footprint: sort scratch buffers (radix counters, local offsets, index buffer) are allocated to cover the full pool at load. Keeping MaximumAmount tight on sorted emitters saves memory, but the per-frame compute savings come from a lower live count, not a smaller pool.
Identity and Unsorted are free per-frame (no sort dispatch).
Practical heuristics¶
Start with ``Identity``. Switch to
Depthonly if you can see transparency artefacts.Fire / smoke (additive or multiplicative blends):
Identityis fine. Gains from sorting are invisible.Alpha-blended textured billboards (soft particles, rain drops on a bright sky):
Depth.Mesh-instanced 3D particles with opaque materials (debris, rocks):
Reverse Depth.Memory-constrained targets: if the emitter does not need sort indices, pick
Unsortedto drop the index buffer allocation.Subemitters: inherit sort choice from the source when they share visual style (fire → embers: both additive, both
Identity); diverge when blends diverge (fire → smoke: fire additiveIdentity, smoke transparentDepth).
Gotchas¶
ParticleSystem.SortingCameraOverridelets you point sort key computation at a non-default camera. Useful when particles live in a secondary viewport with its own camera. If empty, the scene’s default camera is used.A material that declares a
SortingIndicesBufferuniform must not be paired withUnsorted: the binding has nothing to read. The shipped 2D rendering materials all reference the sort buffer, so keep those on a sorted mode.