do you by any chance know what exactly happens when importing custom terrain in Cesium Ion and combinig with World Terrain? I would like to debug a problem, but I should probably understand it better.
The actual issue is I’m trying to display Swisstopo 3D buildings vector tiles and they are a bit off. However if I use Swisstopo terrain provider API they are showing precisely. But that terrain provider only has data for Switzerland, the terrain outside of Switzerland is flat.
So I imported swissALTI3D - swisstopo using “Add Data” in Cesium Ion and selected to combine it with World Terrain.
With that option, the 3D buildings still show underground, so I transform the 3d vector tiles to lift them around 10 meters higher.
Still, the 3d buildings are showing a couple of meters above or below terrain, and very slightly rotated, with respect to terrain hints (bridges, roads, etc)
Using the Swisstopo terrain provider, they are showing precisely as expected. So I’d like to debug the issue and hopefully achieve the same result, while keeping terrain outside Switzerland showing correctly, too.
Because the import of terrain is very time consuming, I would like to inform myself better before trying things. Do you know what exactly is happening when basing custom terrain with World Terrain?
Are those 2 terrains for example averaged or only one is used exclusively or only the higher one? Sorry for my ignorance, let me know if there is any documentation about it.
Hey @bujak, I have expericend a similar problem, my buildings floating in the air. I used my own terrain fused with Cesium world Terrain. And my topology was right but the terrain height was all wrong, hard to describe but it was in line with the world terrain. See this illustration
The gray part is my terrain and the black is Cesium World Terrain.
I found out that the problem was that when I uploaded my own terrain I choose “auto detect” on Height reference (resulted in the “wrong” on my sketch) Instead i choose WGS84 which now displayes the data correct. I assumed the problem was a lot bigger that changing the height reference…
You can use this code to check the height in console to see if it is what it should be there.
new Cesium.ScreenSpaceEventHandler(viewer.canvas).setInputAction((action) => {
console.log("屏幕:", action.position);
let cartesian3 = viewer.scene.globe.pick(viewer.camera.getPickRay(action.position), viewer.scene);
console.log("Cartesian3:", cartesian3);
let cartographic = Cesium.Cartographic.fromCartesian(cartesian3);
console.log("latitude and longitude:", {
latitude: Cesium.Math.toDegrees(cartographic.latitude),
longitude: Cesium.Math.toDegrees(cartographic.longitude),
height: cartographic.height
});
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
To add, from my understanding, the terrain you upload will triumph the base terrain over that area it covers. And if you upload another “own” terrain over terrain you already uploaded and choose that as the base terrain on the newest upload it will triumph that terrain. Kind of a 3D puzzle, to simplyfy it.
Maybe someone can confirm this or correct me if I’m wrong about my understanding?