ebeaufay / threedtiles

3DTiles viewer for three.js
MIT License
270 stars 32 forks source link

Unsupported glTF-Binary header #4

Closed Enoooch closed 2 years ago

Enoooch commented 2 years ago

If getting this error in LegacyGLTFLoader.js, is it possible to make it compatible with header = { version: 2 ... } ?

ebeaufay commented 2 years ago

The tiles are normally loaded with the regular threejs GLTF loader (version 2) and if it fails, it tries the LegacyGLTFLoader (version 1).

I think that your tiles are not compatible with the threejs decoder somehow, version 2 should be handled.

Care to share the tileset? I can investigate.

Enoooch commented 2 years ago

Thanks for responding, I sent a link to your email.

ebeaufay commented 2 years ago

Ok so the Tiles you have use KHR material variants which is supported by threejs but I need to "activate" it in my code. Should be easy enough, I'll ping you when I push a fix.

ebeaufay commented 2 years ago

Apparently, the threeJs gltf loader doesn't recognize that a certain GLTF extension is specified in the tiles. I don't know enough on gltf to say whether threejs is wrong or the tiles are badly defined.

I can hack in the loader and force it to load the extension : EXTENSIONS.KHR_MATERIALS_UNLIT which does the trick. However there's another issue with those tiles:

They are georeferenced through a transform on the top level tile. This means they are meant to be visualized on a globe. Again I can hack-it and disregard the transform which brings the origin to 0,0,0 (I could also put it on the globe here https://github.com/ebeaufay/UltraGlobe).

Finally, the bounding volumes are badly defined. The mesh is Z-up while the bounds are Y-up. The tile refinement is therefore wrong.

Are you building a pipeline to display many such models or are you just looking to make a single demo with this data?

If you want a single demo, I can help you do a hack. If you want something more robust, you'll need to fix your 3DTiles. As it happens, I have a tool to generate optimal 3DTiles from the original mesh. If you have the original mesh and can share it, I'd be happy to re-convert it to 3DTiles.

Enoooch commented 2 years ago

Much appreciated.

Actually, I just want to render tiles in three.js without cesium.

BTW, I don't have the original data, but I will keep looking solutions that combine GIS in three.js.