Cesium Vertex Information

Hello everyone,

My problem is there seems to be no way to access per-feature vertex/position information in a tile. Assuming a tileset containing multiple cesium 3d tiles, it is possible to pick each individual feature separately as long as the mouse is over a specific location. For example, a 3d tile with a batch table of 50 buildings would allow for feature selection of each building separately.

However, if I would like to sort all the building features by distance to the camera, and obtain an ordering that I can use it dynamically in javascript, it seems it is either very difficult or impossible to get the position (or distance from camera) of each feature.

Hi,

One solution here would be to add a position property to the Feature Table for the tileset. Then, when you pick the tileset feature, or iterate through them like with the snippet below, you can retrieve the property value with the getProperty method.

tileset.tileVisible.addEventListener(function(tile) {
    var content = tile.content;
    var featuresLength = content.featuresLength;
    for (var i = 0; i < featuresLength; i+=2) {
        content.getFeature(i).color = Cesium.Color.fromRandom();
    }
});

``

Depending on what you’re trying to accomplish, you could also use that value for 3D Tiles Styling.

If you want to go a more direct approach, this forum thread addresses accessing the Batch Table directly, but uses some of the private API.

Thanks,

Gabby

Thank you Gabby. I really wouldn't know how to add the position properties to the feature table from the gltf files, I am converting from citygml files to b3dm/json format.

I have tried to access all kinds of information from private parts of the API, going so far as to see that in the batch table, under pickIds->pickObjects->primitive there is an attribute (_va) that seems to contain at least the number of vertices in each building (for two tiles where I have around 6k buildings).

I was wondering if there is any really subtle method, borderline hack, to access the vertex positions in each building without the feature table containing such information explicitly.

Regarding the other forum, I would say most of my features reside at the top level of the 3d tile, so that I cannot even get more specific bounding volumes for subsets of features. I would really need to go from the general tile directly to per feature positions.

I can access per-feature colors and change them, but if I were to access vertex position tables per-feature, that would be fascinating!