My project is to render LIDAR point cloud in a scene and I’m using the SolidParticleSystem to do so since I need to control the position of each point in the cloud (thus can’t use the regular particle system).
I’ve noticed after hours of searching online that SPS and other particle systems work good (60 fps) on static / animated (changing rotations - example) point cloud but not when changing the positions. I’m seeing a much degradation of performance when changing positions of particles in SPS.beforeUpdateParticles when changing positions for 30K points.
Also, I’ve been reading this post which gave me a lot to think about and try but still there were no positions changing what so ever.
Do you guys have some idea which I can research to enhance performance please?
Could you set a PG example so we could check how to improve the perfs if possible ?
30K iterations each frame are quite a big number for a mono-threaded engine like JS whatever you want to deal with.
So please tell us more precisely what you want to do and what issue you are facing.
The example you gave is 20K planar particles and run at 60 fps in Chrome on my computer.
Without more details, we could suggest for instance for now :
to not update all the particle positions each frame but only some of them
to decouple the logic computation (if any) from the rendering loop. Example : get your fresh data from some external source at some interval, compute them or treat them in a web worker and when done, pass them to the SPS or any other particle system as positions to be rendered
to use less particles than 30K and to recycle them, the idea here would be to compute only really visible particles within the viewport
Those who didn’t change from last update? I’ll look in to it.
Yes, it is happening already.
I want to render Lidar cloud points (about 28800 points each cycle - let say for convenience per one second) and to achieve ~60FPS.
I currently use SPS and have FPS degradation, instead of 60 FPS I get 50 FPS and if I add more objects to the scene the FPS keeps falling.
I played with VeretexData to find if I could somehow imitate SPS :
actually this is what the SPS does for you
in your example, you create a new array each call, what is not a good practice for the memory management
When I talked about what you wanted to achieve, it was more about the rendering goal you had than the global project (Lidar). Say, you want to manage 28,8 K colored points or quads (so billboarded 2D is enough).
You get new data every second. Right, this lets you 60 times the time to update every rendered particles at 60 fps. Said differently, you could update only 1/60 th, or 1/28.8 th to be closer to your model, so 1000 particles only, each frame.
Are the 28.8 K particles really to be visible at once in the viewport ? If not, you could depict 28.8K points with less recycled particles. If you keep under 8-10K rendered objects, any particle engine will be ultra-fast.
another option if you can’t optimize the current particle system you are using (don’t forget there are 3 ones : the standard particle, the GPU particle system that’s the fastest one and the SPS for 3D particles) for your need
and if you’re willing to dig a bit WASM side, here’s a WASM SPS prototype animating 40K solid particles : BabylonJS WASM SPS
I went through this page and other pages from a google search and I don’t see how you can control each particle position…Create n different emitters that will shot 1 point each time and each cycle change their location ?