Write particle system to depth buffer

Hello there!

I have read here that particles can’t have depth in babylon, but then it is a bit old and particle systems have a forceDepthWrite property so I want to ask: is there a way to write particles to the depth buffer using modern babylonjs?

Here is a PG with particles and a depth buffer:

If it is not possible, then is it possible to render particles after postprocesses (yeah that sounds silly I know)? :thinking:

Probably with the solid particle system?

That would work yes, but simple particle systems have a lot of functionnality built in such as individual velocities, directions and colors that would take quite a lot of effort to reproduce using an SPS :confused:

And also SPS are not designed to update the position of hundreds of particles every frame, this would tank the performance.

If there is an alternative, I am very much interested!

Try searching the playgrounds here Playground search page | Babylon.js Documentation . Search indexing isnt great, but try searching for exact class or function names you’re interested in, i can remember many good examples for what youre trying to do.

1 Like

Okay I managed to make something very decent using the SPS, and the performance is quite better than what I expected :ok_hand: The playground helped a lot indeed!

here is the original with simple particle systems for comparison:

reminds me a bit to this demo with shader technology
“Star track” by Avin Lambrero | Babylon.js Playground (babylonjs.com)

Nice, and yea sps is very fast bc its one geometry

1 Like