The idea is to render the whole scene except the particles in a render target, then draw the whole scene again. In the particles fragment shader we then use the RT depth and opacity to adjust the particles alpha, as seen in this codepen: https://codepen.io/martinlaxenaire/pen/rNXQeKd
6/9
6/9
Comments
To get the best performances across all devices, I had once again to come up with creative ideas.
I wrote a helper that constantly watches the FPS over a given period of time and use it to set the quality of the scene, from 1 (poor) to 10 (excellent).
7/9
8/9
I hope you liked this little technical breakdown. Let me know if you have any questions.
Also, I'm available for freelance work so hit me up if you've got any #webgl or front-end needs!
https://museedelaplaisance.com/
9/9