Hi all,
I am trying to make this selection demo better but stuck on filtering out fully hidden meshes.
The existing solution is very slow due to raycasts.
is there any better solution to filter hidden meshes or selecting meshes in general?
Using occlusion queries in this scenario won’t work anyway (TIL!) From the docs:
Very important : The meshes you activate for occlusion requests must be rendered after their potential occluders! The easiest way to do this is to set their renderingGroupId property to a value greater than that of the occluding meshes (don’t forget to call scene.setRenderingAutoClearDepthStencil() with the appropriate parameters, as you probably won’t want to clear the depth buffer between rendering groups).
As far as other methods go, there may be a way via stencils or by GPU picking in the selected screen area.
Are you trying to filter out occluded objects for performance reasons?
I am developing a feature in an app where users can select machine parts and set texture/color to the group.
I ended up implementing color picking. Its faster than raycasts and pixel perfect so partially visible meshes can also selected.
Color picking: https://www.babylonjs-playground.com/#Q5KMXP#129
What i have if a tiny bug where in imported meshes, sometimes after drawing selection box for first time it does not select meshes but after that it works fine.
do you have any idea what might be causing this issue? https://www.babylonjs-playground.com/#Q5KMXP#130