B3DM - how should batching be achieved?

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.

No code.

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

I'm struggling to create a maximally coherent (in terms of used technologies) workflow for converting kml/collada files to b3dm.

4. The Cesium version you're using, your operating system and browser.
Cesium 1.38, Chrome, Windows/Linux (ubuntu)

The collada->gltf converter on the website uses a forked version of COLLADA2GLTF that is used internally by the Cesium team, this is probably why it preserves batch ids while the others don’t.

I recommend batching on the glTF level. Even though it’s a transmission format the data layout is pretty similar to COLLADA and shouldn’t be too hard to work with.

Also thanks for doing a bunch of research ahead of time!

Maybe you can take a look of objTo3d-tiles.

在 2017年10月30日星期一 UTC+8下午11:40:01,Lech Karłowicz写道:

Sean, is there a plan to upstream at least the _BATCHID conversion to COLLADA2GLTF at some point?


Hey Christopher,

We don’t have that planned since we’re starting to move away from all the 1.0 related tools. I think it would be better if the 2.0 branch of COLLADA2GLTF preserved non-standard vertex attributes (maybe it does… I haven’t checked).