How to interact with a Tileset that doesnt contain/recognize Cesium3DTileFeatures?

Hi Cesium-community!

I’m a bit stuck with interacting with parts of a model (created in Rhino) in my Cesium scene.

(As my initial post didnt appear in the forum, I am writing again).

1. A concise explanation of the problem you’re experiencing.

  • I’ve created an imaginary city model in Rhino.

  • Some buildings have special matierals/material names in order to identify them later on.

  • Rhino obj export > obj2gltf command line tool > upload gltf to Cesium ion

  • Georeferencing the model in Ion

  • I’m importing the city model via Ion as a Cesium3DTileset to my project.

  • The models are visible and with materials as expected:
    rhino-obj-gltf-cesiumion-cesium.png

  • I try to implement either the FeaturePicking or Interactivity example, but when using :
    var pickedFeature = viewer.scene.pick(movement.position);
    console.log(pickedFeature);

    ``

    what is returned/logged, is not a Cesium3DTileFeature like in the examples, but an Object with “content” and “primitive”.
    And I get an error “pickedFeature.getProperty; is not a function”.

  • I know my initial model doesnt have any attributes or similar data as official urban gis models often have. Could this be a reason the tiles have no features?

  • My current question is: how to interact with the single buildings in this case ? I’d like to:

  • highlight a hovered building

  • choose a building

  • zoom to it

  • query/display the chosen building’s material name (the only identifier I guess I have with such a model)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

I add the models to the scene in the usual way:

var city = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(34830) }));

``

And then use the code from https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=3D%20Tiles%20Feature%20Picking.html .

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

My end goal is to be able to have a 3d map where some certain buildings are selectable and when clicking on them, some data is visualized that is not stored in the imported 3D model itself (ie it is referenced by eg building’s material ID from another source).

As a start I would be happy to be able to display the material names of the single buildings

4. The Cesium version you’re using, your operating system and browser.

1.58, Win10, Chrome

Thanks a lot for any kind of comments ond input in advance!

Hi, welcome to the Cesium forum!

Unfortunately, the CAD tiler doesn’t currently output any feature information, which means there’s not much you can do on the CesiumJS side to capture/style individual models. As an example, I added a function to hide whatever model was clicked in this 3D Tileset. Notice that clicking on say, one couch cushion, will hide all the other cushions too.

This is because geometry is batched in 3D Tiles (which is great for performance and streaming speed) but it means you need a way to get back the features. For that New York City example, the same thing happens, but the source data has a unique building ID for each building, so that metadata is preserved and can be used for styling. We do have a feature request open to add this option to the CAD tiler:

https://github.com/AnalyticalGraphicsInc/cesium-ion-community/issues/132

Feel free to chime in there or :+1 that!

Hi Omar,
Thanks for the quick reply and the kind welcome!

Looking forward for the this new feature then :wink:

But for now I continued to search for a workaround.

I got a test based on the Interactivity example to work after importing the same model as georeferenced Collada/KMZ (via CityEngine), but it seems that the metadata is only what, I assume, ION is automatically creating (Lat / Lon / Hei / Terrain Hei).

The same happens with a KML file from a local municipality’s GIS database: it only has the forementioned 4 attributes, though it should have more metadata (uuid, building type, etc).

Would you have any recommendations how to solve this, is there a way to convert the models into 3DTiles so, that they would include initial metadata/attributes (eg building ID and/or material ID)?

Thanks and have a great start of the week!

Grete

CityGML should automatically have all of its metadata included, based on the description I wrote up here: https://github.com/AnalyticalGraphicsInc/cesium-ion-community/issues/201#issue-470396135

It also included a code sample for listing out all the per-feature properties. Are you not seeing all the properties in your produced tileset that were in the original source file? If not, let me know what the asset ID is and I’ll take a look.

Hi Omar,
Thanks for your support and pardon the long silence.

The project has be on hold, but once it goes further, I would check out more about the the on-premise CLI mentioned in the post you shared. Or to look into ways to do the import the model via CityGML.
The KML ExtendedData is exactly what I initially expected to be able to access with ION’s online workflow.

Cheers

Grete