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

Improvement: pickingGeometry #10

Open
bennlich opened this issue Jan 14, 2022 · 1 comment
Open

Improvement: pickingGeometry #10

bennlich opened this issue Jan 14, 2022 · 1 comment

Comments

@bennlich
Copy link
Contributor

Do you have any thoughts about adding a pickingGeometry feature, sort of analogous to the pickingMaterial feature?

This is coming up for me in a project I'm working on right now where I'm using troika-three-text to render text. Troika uses a totally custom glyph geometry and custom shaders to render a paragraph of 2D text. I was able to make the object pickable with a custom pickingMaterial, which is awesome, but the geometry that is now pickable is not ideal (see protectwise/troika#177 (reply in thread)).

Now I'm wondering if it might be generally useful to be able to present objects to the picker with alternative pickingGeometries. Would it ever make sense for performance to e.g. use a simpler picking geometry than the one used for rendering to the user?

One challenge I guess, compared to a pickingMaterial, is that you would somehow need to keep the pickingGeometry up to date with the actual transformations on the object. Maybe pickingGeometry should be a function that is called with the real geometry as its argument, and returns a geometry to use for picking?

@bzztbomb
Copy link
Owner

Actually, this is a really good idea! Initially, I was thinking it would be a bit unwieldy due to having to keep things in sync, but all of that information comes from the object, not the geometry. So syncing them isn't really a big deal, you'd only need to worry about sync if you're modifying the geometry itself (then you'd have to update the picking geometry to match it).

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

No branches or pull requests

2 participants