I downloaded the examples in GitHub - CesiumGS/3d-tiles-samples: Sample tilesets for learning how to use 3D Tiles and I’m trying to display them but the Cesium3DTileset
will not load any tileset JSON file I give it.
For example, I can serve those examples locally by running python -m http.server 8089
at the top level of that repository.
Then I make a simple HTML file with the following to JS to attempt loading the tileset:
// .... all my other config for Cesium
viewer = new Cesium.Viewer('cesiumContainer')
// 3D tiles addition
viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
var inspectorViewModel = viewer.cesium3DTilesInspector.viewModel;
var tileset = new Cesium.Cesium3DTileset({
url: 'http://0.0.0.0:8089/1.0/TilesetWithRequestVolume/tileset.json',
});
viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);
But nothing happened and there are no logs/erros in the JS console in the browser. Further, I can tell that Cesium isn’t even trying to load the tiles if I zoom to where I know they are located. The local server’s log only every shows the tileset.json
file being accessed.
$ 3d-tiles-samples-main python -m http.server 8089
Serving HTTP on 0.0.0.0 port 8089 (http://0.0.0.0:8089/) ...
127.0.0.1 - - [24/Nov/2021 11:54:08] "GET /1.0/TilesetWithRequestVolume/tileset.json HTTP/1.1" 200 -
What really concerns me is that Cesium3DTileset
will just silently fail if you give it a bad URL. For example, the following will not give any errors/warnings in the JS console.
var tileset = new Cesium.Cesium3DTileset({
url: 'http://0.0.0.0:8089/foo/bar/this/does/not/exist.json',
});
viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);