-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
This primarily stems from an observation I've made of the behavior of billboards at the horizon. Ideally billboards usually should be drawn "on top" of everything else until they are on the opposite side of the globe.
By default in Cesium this happens "for free" out of the box as can be observed in the Billboards sandcastle
When it's near the horizon but on "this side"
When the globe is turned slightly so the billboard is on "the other side" of the globe it gets clipped off
However, when using a global 3d tiles tileset like the Google photogrammetry tiles this behavior is not the same. The billboard is always drawn "under" the tileset
"In front"
"Behind"
The behavior of the 3dtiles can be replicated with terrain if you set globe.depthTestAgainstTerrain
to true
.
I think the default behavior of terrain is normally the expected result out of the box (given issues like #12396) however this requires some new architecture to add a way to ignore depth tests against a specific asset or tileset like we do with the terrain.
Workaround
The best solution right now is to control the value of disableDetphTestDistance
on the billboard itself. Setting this to Number.POSITIVE_INFINITY
"works" to always show a billboard on top of 3d tiles as terrain but it also allows you to see billboards on the other side of the globe.
A niave workaround I used for the Moon sandcastle is to set this distance based on the position of the camera which lets you approximately achieve the same cutoff at the horizon but it's not perfect. Check out this sandcastle showing this off
disableDepthTestDistance: new Cesium.CallbackProperty(() => {
return Cesium.Cartesian3.magnitude(viewer.scene.camera.positionWC);
}, false),