Instead of drawing particles as geometry and letting the blender sort it out, treat the frame as a buffer in memory and composite into it by hand. One GPU compute thread per particle:
- Project the particle to a pixel.
- Pack it into one 32-bit word: a 16-bit depth in the high half, an
rgb565 color in the low 16. atomicMax that word into a storage-buffer framebuffer at the pixel’s flat index.
Depth is stored inverted (1 - ndc.z), so the nearest particle produces the largest word. That means a single atomicMax performs the depth test and the composite in one operation: nearest-wins per pixel, deterministically, with no blending and no draw-order dependence. Fireflies are eliminated structurally, exactly one particle writes each pixel, so there is nothing to stack. A second atomic buffer counts hits per pixel, which becomes a controlled glow term in the resolve instead of uncontrolled additive bloom.
Then a fullscreen pass reads the framebuffer back. One quad, whose fragment takes the integer screenCoordinate, turns it into the same flat index, reads the packed word straight out of the storage buffer, and unpacks depth and color. Zero hardware overdraw. Exactly one particle decides each pixel. Crisp specks, true black voids, roughly 10x more particles than the sprite approach can hold before clarity collapses.
This is software rasterization, the technique that predates hardware rasterization, moved onto the GPU because compute shaders finally allow the scattered atomic writes to memory that the fixed-function pipeline will not give you.