CloudPoint optimization

Hey,

I’m new to graphic development :slight_smile:

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

etc

Thanks for quick replay.

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 :
https://www.babylonjs-playground.com/#WZNWVG#13

actually this is what the SPS does for you :smiley:
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

2 Likes

Yes.

How can I use the GPU particles? I need to control particles …

https://doc.babylonjs.com/api/classes/babylon.gpuparticlesystem

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 ?

Do you mean this :
https://doc.babylonjs.com/api/classes/babylon.particlesystem#updatefunction

It’s not in the GPU Particle System API

GPU particles cannot be controlled individually as they are purely on the GPU

Hi @Wrath_014 and welcome from me. This is a development of the PG (playground) you gave that uses the existing array https://www.babylonjs-playground.com/#WZNWVG#14 I think it is a little faster.

4 Likes

this playground is so cool to observe, it looks like full of molecules doing their lives :smiley:

  • PointCloudSystem to implement : added on my 2019 to-do list
3 Likes

Nice idea :slight_smile:

Thanks :slight_smile:

its coming soon (by JohnK) : https://github.com/BabylonJS/Babylon.js/pull/6893

1 Like