Globe depthTestAgainstTerrain resets when user changes terrain provider

I am using the native base layer picker from the Viewer with custom Imagery providers, and the default set of Terrain providers. I've been having a problem where billboards half-disappear beneath the terrain when the user switches from the basic ellipsoid to the STK meshes, and I haven't been very happy with the outcome when I set the billboard's heightReference to CLAMP_TO_GROUND, but it looks good when I disable depthTestAgainstTerrain.

The problem is that this value gets set to `true` any time the user selects the STK terrain provider from the dropdown. I don't see any event exposed to hook when this setting has been changed, and it seems sort of brute-force to just poll for it myself. Maybe there's some setting I can change that will turn this off on a per-provider basis, rather than changing the property on viewer.scene.globe directly?

Thanks,
James

In case it's relevant, the "unhappy outcome" with CLAMP_TO_GROUND turns out to actually be a disableDepthTestDistance known bug: https://github.com/AnalyticalGraphicsInc/cesium/issues/5331 and https://github.com/AnalyticalGraphicsInc/cesium/issues/5501. If those get fixed, I can probably get away with leaving depthTestAgainstTerrain alone.

-J

Hi James,

I’ll look into the on new terrain event loaded event. In the meantime, check out this thread, which is on the same subject. I provided code for a terrain visibility test that a helpful community member expanded on which should do what you need: https://groups.google.com/forum/?hl=en#!msg/cesium-dev/ZSGJAUqnGR0/_lPChfGTAQAJ;context-place=forum/cesium-dev

hope that helps,

  • Rachel

Hi there,

Also check out terrainProviderChanged: https://cesiumjs.org/Cesium/Build/Documentation/Globe.html#terrainProviderChanged

Hope that helps,

  • Rachel