ebeaufay / threedtiles

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

How to load local tiles (.b3dm) #24

Closed sau0409 closed 5 months ago

sau0409 commented 5 months ago

I am trying to load local 3d tiles (.b3dm), but I am facing some issue. My flow I have 300mb+ .obj file, I converted that to 3d tiles using https://github.com/OpenDroneMap/Obj2Tiles. Now I want to load them but I am facing some issues.

const ogc3DTile = new OGC3DTile({ url: "output_b/tileset.json", renderer: renderer, geometricErrorMultiplier: 2.0, centerModel: true });

error: Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL

ebeaufay commented 5 months ago

Hi, the URL can't be a local file you need to serve it via an http server.

I use 'http-server' look for it on npm. You can very easily start a server from a folder on your local system, the url will then be http://localhost:8080/tileset.json

If you're on windows and you just want to see the conversion result you can use this: https://github.com/ebeaufay/desktop-3dtiles-viewer

sau0409 commented 5 months ago

Thank @ebeaufay it worked.

But I am facing another issue. I have cesium 3d tiles generated though metashape. I amtrying to load them, but its failing. But other models works fine. It culd be an issue of DRCO loader ? I am using vite.

There is not much in console also.

Screenshot from 2024-03-30 23-40-30 Screenshot from 2024-03-30 23-39-07

ebeaufay commented 5 months ago

Draco loader should work by default.

I'm not used to Vite but this syntax error is strange.

Check the individual tile extensions. B3dm or glb is fine but cmpt, i3dm and pnts are not supported.

Also check the version inside the tileset.json. 1.0 and 1.1 should work but I've just recently added 1.1 so it could be a bug.

If that fails, send me a link to the tileset or if you don't want to share the entire thing, just the tileset.json and one of the tiles.

ebeaufay commented 5 months ago

Also, on windows you can try the desktop viewer I linked. If the tile set works there, the problem is with your code