I have a model with more than 20,000 cubes, at first I try to use the instances to optimize it ( https://www.babylonjs-playground.com/#ZEZLAT#50 ) but the speed of rendering it was so terrible for more than 5000 cubes, then I try to use the SPS, one of my problem with SPS is the bounding box, because I need the bounding box of each cube. how can I add the bounding box to my model in SPS?
I use particle.setBoundingInfo(new BABYLON.BoundingInfo(newMin, newMax)); to set the my own bounding box for each cube, but again I got an error. is it possible help me know how can I set the bounding box for each cube?
in my model I have also a Gizmo box which is used to delete the cube, I mean when my cubes are inside the Gizmo box I can push the delete button and deleted the cubes inside the box. I have built it with the aid of the instance, but the problem with instance was when the number of cubes go over 5000 there were lag on my rendering, so because of such a problem and in order to optimize the rendering speed I decided to use SPS to get high performance for my 20,000 cubes.
and now I don’t know how can I access to for example particle.getBoundingInfo().boundingBox.minimumWorld.x. because I need getBoundingInfo of each particle to use the Gizmo box to cut the Block model.
I think that you can build your SPS with particleIntersection set to true so all the particle BBox will be instanciated.
Then you set it to true or false at any time (so for any frame you want) so computations are/aren’t done at will.