1. A concise explanation of the problem you're experiencing.
after a lot of reading and testing some different tools I'm still confused about what is the best way to batch buildings into b3dm files. I can see at least three approaches, each on one of the three stages of 'standard way' of creating b3dm (collada->gltf->b3dm).
- batching on collada files' level. I understand that by extending collada's vertices attributes with input with BATCHID (<input semantic="BATCHID" source="#batchids"/>) I should be able convert it to a gltf file, that has a buffer with encoded vertices positions as well as that additional BATCHID attributes.
I think, that one of the advantages of such an approach is that if you're combining the geometries on collada file level, you are not working on 'Transmission' gltf format but on 'ussage' collada format, that is supported by many tools.
The requirement for such an approach is to have tools that preserve collada BATCHID attributes during conversion to gltf. From what I tested, the online converter (https://cesiumjs.org/convertmodel.html) preserves batchid from my test collada and writes batchid attributes to gltf. None of the versions of the collada2gltf converter that i tested locally did that (newest and older binary linux and windows builds, some older builds compiled on linux). I'm not really sure if this is some kind of my mistake (bad collada?) or if the online converter adds batchid in some another step (gltf-pipeline tools?) and collada2gltf never did that itself. If the latter is the case, I don't understand why couldn't it be done in one step conversion from collada to gltf. If its done in two steps, the tools have to look into collada twice and twice write some data from it to the same gltf.
- batching on gltf level. You can batch models on gltf level. You can do it in different ways - by adding separate position and batchid buffers for each batched model, or by decoding all gltfs buffers, combining them and then encoding again (creating some buffer views at the same time). This shouldn't be that hard to do (there is an example code in https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/blob/master/samples-generator/lib/createGltf.js), but I don't like working on transmission format (decoding and encoding back buffers that are prepared not for manipulation but for rendering). Or am I missing something here and this is the right place to do it?
- batching on b3dm level. You can 'batch' b3dm files itself to create cmpt files. This approach is no real batching (it creates a collection) and it's not good from the performance perspective.
Any comment on that would be appreciated.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
4. The Cesium version you're using, your operating system and browser.
Cesium 1.38, Chrome, Windows/Linux (ubuntu)