CesiumGS / 3d-tiles

Specification for streaming massive heterogeneous 3D geospatial datasets :earth_americas:
2.11k stars 467 forks source link

Cesium - one object in two tiles - question about batchId #721

Open JacekTomaszewski opened 1 year ago

JacekTomaszewski commented 1 year ago

Hello, I’m generating tileset with object splitted between two tiles. They are represented as two different objects (2x Cesium3DTileFeature), having the same batchId & featureId, but they are placed on different 3DTile.

1 2

Is it achievable to merge them to one object? Or is it any mechanism in cesium or extension to treat them as one object, for example at picking?

javagl commented 1 year ago

Generally, and a bit roughly speaking, the question of "What is one 'feature'?" can be answered with "Everything that has the same feature ID". On a slightly more technical level, I could ask some questions: Where and how are you assigning the IDs? Are you creating these as B3DM- or glTF files? Are you using the 3D Metadata format (with EXT_structural_metadata?)

In terms of the expected behavior: I think that there is no built-in mechanism in CesiumJS to create a single (truly unique) instance of Cesium3DTileFeature for all objects that have the same feature ID. (For a variety of reasons - I could describe them on a conceptual level, and others might go deeper into technical details here).

If your goal, on the side of the application, is to have a single object for each feature ID, then it will probably be necessary to implement this sort of mapping manually in the application itself. For example, when referring to picking, it sounds like the goal is to have something like

  const picked = viewer.scene.pick(movement.endPosition);
  const feature = obtainFeature(picked);
  const myUniqueObject = getUniqueObject(feature.featureId);
  ...

where getUniqueObject makes sure that there is one object for each featureId (even when this featureId may the the same for different Cesium3DTileFeature objects). If this is the intention, then there are some architectural questions related to that, but I'd like to make sure that I understood the question correctly so far.