I find that Babylon do not have built-in GPU picking solution.
And in several topics, people mentioned it but without giving any PG.
So, i am pleasure to share these PGs for those who need a guide:
Instanced mesh case:
Ray picking(64k instances, 0.7 million faces, 25 fps): https://playground.babylonjs.com/#RC2IAH#62
GPU picking(343k instances, 8 million faces, 60 fps): https://playground.babylonjs.com/#RC2IAH#61
Non-Instanced mesh case:
Ray picking(27 meshes, 13 million faces, 30 fps): https://playground.babylonjs.com/#681PBG#2
GPU picking(27 meshes, 13 million faces, 60 fps): https://playground.babylonjs.com/#681PBG#7
Amazing, thanks for sharing!
Hey what about having that in the engine? @sebavan what do you think?
This is amazing. Would this approach generally work in a complex scene? Is it possible that the index mapped color is the same as for example tree or grass in the scene?
I really love the idea and I guess a PR of a GPUPicker system would be amazing ???
You can control the renderTarget.renderList to add or remove meshes which you wanted, like this (let some of the spheres use GPU picking, the others use Ray picking)：
And consider of the color conflict problem, you could do these simple works:
- Keep the color number value unique in global (a global increasing count value should be an easy way)
- Replace the environment colors (for example: the background color) like the picking meshes do (give it an unique color also) before renderTarget rendering
After finishing my own project, maybe i could do this for community.
At that time, it will be more stable and flexible.
@syntheticmagus was working on something like this, but I don’t know if it was finished.