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

Handle features for picking in a more scalable way #10025

Open
ptrgags opened this issue Jan 20, 2022 · 0 comments
Open

Handle features for picking in a more scalable way #10025

ptrgags opened this issue Jan 20, 2022 · 0 comments

Comments

@ptrgags
Copy link
Contributor

ptrgags commented Jan 20, 2022

Right now, the picking system requires making a Cesium3DTileFeature (or ModelFeature) for every feature in the property table. This can be problematic, especially for point clouds:

  • In ModelExperimental, right now property tables are turned into feature tables without any checks for the size or whether a tile is a point cloud. This means creating thousands if not millions of Cesium3DTileFeature in memory 😬
  • In 3D Tiles 1.0 code, picking is disabled point clouds to avoid such a problem

If possible, it would be better to store features in a more scalable way. A couple initial ideas, though I think this requires more discussion.

Option 1: Pick ID Ranges

What if we allocate pick IDs by ranges (e.g. a point cloud might store a single object representing 2000 consecutive feature IDs that map onto pick IDs 1000-2999)

Then when a content needs to call .getFeature() it's just a few math operations to index into the global list of features in the context. The Cesium3DTileFeature object can then be constructed on the fly.

There's one big caveat though: for EXT_mesh_features, we want to support arbitrary feature IDs for indexing into external databases. There's no guarantee that these are consecutive. I'm not sure if there's a way to handle this without creating a huge table of valid values in some form or another...

Option 2: Write ID directly to framebuffer(s)

This one would be a larger change of the picking system - what if instead of mapping feature IDs to pick IDs in a constrained uint8 RGBA texture, we used multiple render targets (requires MRT). Then each pixel could write multiple values: (primitiveId, featureId).

This way, the context would only need to store a list of pickable primitives rather than every single feature. The featureId value read from the framebuffer pixel could then be used to construct the Cesium3DTileFeature object on the fly.

The one benefit of using MRT here is it will also help with property texture picking (see #9852)

See also

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

No branches or pull requests

1 participant