I have a fairly complex model of an apartment with a high poly count that needs to be picked. raycasting is too slow so I am using gpu picking.
I am using a pretty standard GPU picking setup that can be found here: three.js/webgl_interactive_cubes_gpu.html at e62b253081438c030d6af1ee3c3346a89124f277 · mrdoob/three.js · GitHub
The problem is the gpu picking seems to select the “last” position hit in the model, and I need the first. As opposed to raycasting which gives an array of positions and I can just take the first position. Here is a quick illustration showing the picking going through walls of a model:
Why is this happening? Is it something to do with the depth buffer? Does it render from back to forward and just gives the first value? How can I guarantee that I am getting the first (closest to the camera) position?
Also, hello everyone this is my first post here and thank you for any help!