mapbox-3dtiles icon indicating copy to clipboard operation
mapbox-3dtiles copied to clipboard

i3dm: add support for uri of the glTF

Open bertt opened this issue 3 years ago • 5 comments

add support for uri of the glTF in i3dm

Currently only a embedded glTF is supported.

Specs: https://github.com/CesiumGS/3d-tiles/tree/master/specification/TileFormats/Instanced3DModel#gltf

when header.gltfFormat == 0: glTF field contains a uri of the glTF when header.gltfFormat == 1: glTF field contains bytes of the glTF

bertt avatar Oct 13 '20 09:10 bertt

testcase: https://bertt.github.io/mapbox_3dtiles_samples/samples/instanced/trees_external_gltf/index.html

error thrown: "Mapbox3DTiles.js:54037 Unexpected end of JSON input" when loading i3dm

i3dm tile have header.gltfFormat == 0 and a reference to external glb https://bertt.github.io/mapbox_3dtiles_samples/samples/instanced/trees_external_gltf/tree.glb

bertt avatar Oct 19 '20 12:10 bertt

loader was not awaiting external response. Pushed new version. Example set at https://bertt.github.io/mapbox_3dtiles_samples/samples/instanced/trees_external_gltf/tileset.json now works.

anneb avatar Oct 19 '20 16:10 anneb

tested, it works now. One possible improvement: the same glb is retrieved for each tile, is it possible to retrieve the glb once (and use a cached version for other tiles with same external glb)?

bertt avatar Oct 19 '20 17:10 bertt

Internal gltf cache added. Risk: requires memory for every new object. Benefit: save many extra requests. For discussion: without internal caching, caching is handled by the browser cache?

anneb avatar Oct 20 '20 12:10 anneb

@anneb Is it possible to store a reference to the instanced model/mesh instead of the downloaded bytes? This way you won't have the 'risk' of requiring more memory and save time and resources on creating the model from bytes for every tile with the same model.

tebben avatar Oct 20 '20 16:10 tebben