-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Supporting picking properties from property textures #9852
Comments
This is not quite correct, it's exponential not additive. If you use just the red channel you get 256 pickable objects (2^8), if you use the red and green you get 65536 (2^16), and so on. |
The suggested approach still feels like it is fighting the derived command system. Also we can think bigger than feature textures. Really they're just an implementation detail and Maybe something more generic like I think this would require a new type of derived command that's separate from the pick command. I haven't thought much more about that yet. |
I was talking with @lilleyse today about this. One idea (requires MRT) is to have 1 float render target for the property texture value (that way we can render properties up to Such a change to the picking system would also be helpful for implementing picking for feature IDs without property tables (#9884) and per-vertex feature Ids (if it can be done without allocating pick objects for everything on the CPU) |
One very fundamental question is still open. This applies to all sorts of picking, and metadata handling in general. So this could therefore be brought up in many other issues. It could even be escalated into a new, overarching issue, which then would have a certain overlap to #10085 ... But I'll start here: How can a user select what is supposed to be picked? There currently is the The user may load two models (maybe just GLB that is tile content). And the structural metadata may have the following structure:
Now, the user wants to ... ~"pick something". And the user has to explicitly say whether the "picked thing" should be One problem is that there is no way for "transporting" information about available metadata to the user. Every form of API call (and even more so: UI elements) will have to involve deep, specific knowledge (or ... assumptions) about the structure of the metadata that will be available. One could think about this with pesudocode: Imagine a user wants to pick something that is stored as Then this would require something like
(and one could wish for a On the highest level, this would probably involve something like the |
The follow-up focusses a bit on property textures in the context of GPM. But on the lowest level, the GPM data is just property textures. One slightly more generic aspect that was mentioned here by @lilleyse is
In fact, the task to try out whether the current picking works for other forms of metadata is still on my TODO list. This is somehow related to the point of generalizing the "buffer-to-metadata" translations that is already mentioned in the linked issue. But I now added this point explicitly in the linked isse, and think that this issue can now be closed as "partially addressed/duplicate". |
Unlike Feature ID attributes and Feature ID textures, Feature Textures present a challenge for implementing picking because both the attribution and the metadata is on the GPU side, in the texture.
An initial, and admittedly flawed, approach to picking certain values from feature textures was accomplished by exploiting how the
pickColor
is generated, with thergba
channels populated from left-to-right, with each channel accounting for 32768 pickable objects. The feature ID texture values were sampled (by modifying thepickId
) and encoded in the unused (arbitrarily set tob
anda
) channels, andPickFramebuffer.js
was modified to extract those values.A more stable approach would be to add a
pickFeatureTexture()
function toScene.js
:pick
, check if the object returned has the requested feature texture.pickId
would be modified to sample the values from the feature texture.pick
would be called again, and values would be read from the channels specified by the feature texturepickId
would be reset back toczm_pickColor
CC: @lilleyse @ptrgags
The text was updated successfully, but these errors were encountered: