What exactly is a feature?

I’ve got a .b3dm model which I’ve added some metadata via the tileset.json.

I’ve added some code so that when I hover over the model I can see the metadata in a tooltip however I’d also like to be able to highlight the selected part of the model structure.

Using this sandbox example as a guide I’ve tried to implement the following:

const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function (movement) {
  if (!picking) {
    return;
  }

  const feature = scene.pick(movement.endPosition);

  unselectFeature(selectedFeature);

  if (feature instanceof Cesium.Cesium3DTileFeature) {
    selectFeature(feature);
  }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

feature instanceof Cesium.Cesium3DTileFeature is never true so selectFeature never runs.

Which leads me to what is a feature and how can I add them to my model?

It may be helpful to have a little bit more information about the contents of the B3DM, or the intended application case.

Broadly speaking: A feature is what you define it to be. More technically: When you have a B3DM, then you can define features by assigning a batch ID to the vertices (for details, refer to 3d-tiles/specification/TileFormats/Batched3DModel at main · CesiumGS/3d-tiles · GitHub ).

If your goal is to have a 3D model with indentifiable subcomponents, then it might also be possible (and simpler) to just use a glTF asset with the EXT_mesh_features extension. It serves exactly the purpose of assigning IDs to parts of the model. An example data set (together with a sandcastle) can be found at 3d-tiles-samples/glTF/EXT_mesh_features/FeatureIdAttribute at main · CesiumGS/3d-tiles-samples · GitHub

Hi Marco,

Sorry i’m a developer and not familar with 3D modelling! the B3DM is a building steel model, beams, bolts, nuts and plates etc.

I’ve tried editing my source .gltf in a text editor to add the “_BATCHID” to the primitives attributes for a single beam but when I then try to open the modified .gltf in blender it errors out.

Is there a better way to add in batch ids in order to turn the beams into features?

The 0 in "_BATCHID": 0 means that the ID values are stored in a glTF accessor, namely the accessor with index 0. And this accessor refers to binary data that contains the ID values. You cannot easily manually edit such a glTF file and add these IDs. Depending on the exact structure of the glTF file, there may be different ways to add these IDs. (These could be the “batch IDs”, or “feature IDs” when using the EXT_mesh_features extension - conceptually, they are quite similar).

Is the glTF file publicly available? From what you said, it sounds like it could be based on a CAD model. So it might structurally be similar to some glTF sample model like glTF-Sample-Models/2.0/ReciprocatingSaw at master · KhronosGroup/glTF-Sample-Models · GitHub . For this kind of model, it might be possible to assign IDs to each mesh primitive more or less generically, but I’d have to look at the possible approaches here…