I have been working on rendering underground assets in Cesium but encountered a problem.
When I rotate the underground object, no matter which angle I use, the underground 3d model always shows even when it’s not supposed to, for example, when looking from the air, it’s supposed to be buried under the terrain.
It’s important that we do not see through the terrain. Otherwise it will be confusing to perceive the underground nature of the object because it will always show despite the viewing angle. It appears that the underground object floats above the terrain when viewing from above.
I actually do not want to see through the terrain. I did not set the terrain transparent but the underground object is still showing as if it is above ground when looking from above.
Ok, hang on. What sort of “underground object” are we talking about? I know billboards and other entities might do this, as their views aren’t linked to the terrain views. Is that what we’re talking about? How do you create these underground objects in Cesium now?
But you upload what data? What is it? Ok, so gltf becomes entity geometries, so the key would be to start with;
viewer.scene.globe.depthTestAgainstTerrain = true
Then play around with the docos for Models at Model - Cesium Documentation especially the heightReference. Default is NONE, but you might make it relative to Terrain (which should push it under, but depends on your reference model and transforms).