Picking for a Complex Model


I have a model with many individual meshes that I want to pick individually in Cesium.

First issue: Performance

If I export from Blender a single Collada file, and convert it into glTF, the picking works fine but the performance is horrendous.

I suspect that there are too many draw calls (e.g. one per mesh).

If I merge all meshes within Blender and export to Collada and then to glTF, the picking only selects the entire model.

However, the performance is great! Once again, it seems that this is due to using one draw call for the whole model.

Second issue: Picking methods

Continuing from the first issue described, I have more thoughts about picking.

One workaround I’m thinking about, is to somehow use a duplicate model with individual meshes for picking, but showing only the model with merged meshes.

On the other hand, I’m also thinking about using the model’s vertex attributes or uv coordinates to conduct picking.

Is there any way I can retrieve the vertex attributes of a model based on a picked position?

I wouldn’t mind tweaking Cesium’s source code to have a custom build, but I’m not sure where to start.

In summary, my questions are:

  • Performance: is there a way to create a ModelCollection? E.g. allowing many models to be drawn using just one draw call like Billboards
  • This would allow me to export each mesh as an individual model, and combined them in Cesium
  • Picking: is there a way to use a duplicate model with individual meshes just for picking, but what is shown is the model with merged meshes?
  • Picking: is there a way to find the vertex attributes of the model, at the face that was picked?

I’m a beginner just starting out with Cesium, loving it for all the things it can do, but I’m currently stuck on the issues above.

Would love some help from the Cesium community!


To answer your questions, none of that is currently supported in the base Model class, without custom code.


What you’re describing is exactly what the Batched 3D Model format in 3D Tiles is designed to handle. Meshes are combined together into a single mesh but differentiated by a BATCH_ID vertex attribute, which allows them to be individually picked but keep the draw count very low. If you go the 3d-tiles branch you should check out the 3D Tiles demo: http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles.html&label=Showcases.

Now the downside is in your case you may not care about the hierarchy / LOD aspect of 3D Tiles, but this is definitely the easiest way to go for now. At the very least you can check out the code that already exists and adapt it to your needs.

We are also working on a 3d-tiles-generator project which will demonstrate how meshes can be batched together for use in 3D Tiles.

Thank you. I'll check it out!