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

Color Picking Shader #3

Open
aevyrie opened this issue Sep 4, 2020 · 3 comments
Open

Color Picking Shader #3

aevyrie opened this issue Sep 4, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@aevyrie
Copy link
Owner

aevyrie commented Sep 4, 2020

For performance, I'd like to render the scene to an off-screen buffer that renders each pixel as an entity encoded into RGBA. Picking is then as simple(😆) as querying this buffer and doing a lookup to return the entity. This would only allow picking for the topmost item (no pick list), and would have limitations with transparency.

A hybrid mode that uses both might be a good solution.

Some input from others on Discord for reference: https://discord.com/channels/691052431525675048/743663924229963868/755912884885913751

@aevyrie
Copy link
Owner Author

aevyrie commented Sep 10, 2021

For reference, here's an article that describes how a picking shader works:
https://webglfundamentals.org/webgl/lessons/webgl-picking.html

Here's another good reference that shows how Our Machinery addressed picking through alpha masked objects as well: https://ourmachinery.com/post/borderland-part-2-picking/

@arjo129
Copy link

arjo129 commented Jul 7, 2023

We have been developing an application that uses an older version of bevy_mod_picking here. We recently ran into the need to have a color picking shader which I've prototyped in this branch. I am open to refactoring it and submitting a new backend (we do eventually need to migrate our app).

@aevyrie
Copy link
Owner Author

aevyrie commented Jul 10, 2023

There is an open PR to add a picking shader to bevy, probably landing next release, 0.12. The plan is to make a backend to support this.

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

No branches or pull requests

2 participants