Camera behavior when at or below terrain height

1. A concise explanation of the problem you’re experiencing.

We have some 3D tile datasets which extend below the surrounding default (Ion) terrain. For example a mining pit which has been dug deeper than at the time the default terrain data was captured.

We also have some 3D tile datasets which sit on top of the surrounding default terrain, but which show a negative camera height, e.g. -32.239458 (south), 115.77787 (east) shows a terrain height as -27m

In both these cases, if the camera is well above the ground height it operates as expected, but as you zoom in on the details it either reaches a point where it stops (i.e. you can’t descend any lower/closer, even though still well above the 3D tile data) and/or the rotation changes so instead of rotating around the mouse pointer location it changes to be an angular rotation around the camera’s own location.

I think this is a collision with the behaviour to prevent the cesium camera from descending below the terrian, but is there a workaround for these cases where it is valid to do that?

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

I might be able to extract a minimal example, but currently entrenched in a lot of surrounding code and data, but hoping this is a known issue to discuss?

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

It is valid for some datasets to be below what Cesium considers to be the terrain surface, while still being above ground, e.g. open-cut mines

4. The Cesium version you’re using, your operating system and browser.

Cesium v1.50, Chrome on windows+osx

I did some digging for this, and I found a PR that disables collision with terrain while the camera is flying to a destination:

Which subsequently led me to ScreenSpaceCameraController.html#minimumCollisionTerrainHeight. Changing that to 0 (or possibly negative?) I think should allow the camera to move without constraint under terrain.

Let me know if that works. This sounds like a pretty interesting project, what kind of application is it for? And does it look good to view 3D tiles under terrain or are you clipping the terrain in that area or something like that?

Hi Omar,

Thanks for the idea, I did give it a try but get rendering crashes when the camera is underground:

It does help to allow zooming closer to the target object, but the camera rotation still goes strange as soon as you are below the height that cesium thinks is the ground.

Regards,

Andrew

This might be related to this error:

Can you try Cesium 1.48 and let me know if that crashes in the same way?