Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU picking for hover/select #1615

Closed
emilk opened this issue Mar 20, 2023 · 0 comments · Fixed by #1849
Closed

GPU picking for hover/select #1615

emilk opened this issue Mar 20, 2023 · 0 comments · Fixed by #1849
Assignees
Labels
enhancement New feature or request 🔺 re_renderer affects re_renderer itself 📺 re_viewer affects re_viewer itself

Comments

@emilk
Copy link
Member

emilk commented Mar 20, 2023

We currently do picking of primitives on the CPU, which is slow, and doesn't work for the GPU-projected depth maps (and is not implemented for meshes).

The long-term best solution is to do all picking on the GPU.

This issue is done when all 2D and 3D picking is done via the GPU, including meshes and GPU-projected depth map point clouds.


The likely approach is to render all primitives to a secondary integer buffer encoding the instance-key. We then read-back a small area under the mouse cursor and to the picking via some smart algorithm that helps the user pick small features.

Naively picking the instance id directly under the cursor will make it difficult to ever select primitives that only cover a pixel or two. To fix this we can read back 7x7 pixels and pick the id that covered the fewest pixels AND are not on the border (things on the border could be the corner of something big). If all id:s are also on the border, then pick the id that covers the most pixels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🔺 re_renderer affects re_renderer itself 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants