Bug: flying to billboard that is clamped to ground goes through Earth

If you fly to a billboard that has heightReference set to Cesium.HeightReference.CLAMP_TO_GROUND, then you can fly into the Earth and see stars. This does not happen for all locations but is consistently reproducible.

To reproduce, paste the following into a sandcastle and click Run:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var bb;

function home() {

Sandcastle.declare(home);

viewer.camera.flyHome(0);

viewer.entities.removeAll();

}

function addClampedBillboard() {

Sandcastle.declare(addClampedBillboard);

bb = viewer.entities.add({

position : Cesium.Cartesian3.fromDegrees(-71.4001, 41.8204),

billboard :{

image : ‘…/images/Cesium_Logo_overlay.png’,

verticalOrigin: Cesium.VerticalOrigin.BOTTOM,

heightReference: Cesium.HeightReference.CLAMP_TO_GROUND

}

});

viewer.flyTo(bb);

}

function addUnclampedBillboard() {

Sandcastle.declare(addUnclampedBillboard);

bb = viewer.entities.add({

position : Cesium.Cartesian3.fromDegrees(-71.4001, 41.8204),

billboard :{

image : ‘…/images/Cesium_Logo_overlay.png’,

verticalOrigin: Cesium.VerticalOrigin.BOTTOM

}

});

viewer.flyTo(bb);

}

Sandcastle.addToolbarMenu([{

text : ‘Home’,

onselect : function() {

home();

Sandcastle.highlight(home);

}

},{

text : ‘Add clamped billboard’,

onselect : function() {

addClampedBillboard();

Sandcastle.highlight(addClampedBillboard);

}

}, {

text : ‘Add unclamped billboard’,

onselect : function() {

addUnclampedBillboard();

Sandcastle.highlight(addUnclampedBillboard);

}

}]);

Select “Add clamped billboard” and you fly into the Earth. If you Run and select STK terrain before “Add clamped billboard”, you momentarily fly into the Earth and then get repositioned, though the final view does not include the billboard (you need to zoom out a bit to see it).

If you select “Add unclamped billboard”, it seems to work fine for Ellipsoid terrain. If you use STK terrain though, the billboard floats in the air, which is why you’d use CLAMP_TO_GROUND.

A similar issue is https://github.com/AnalyticalGraphicsInc/cesium/issues/4999.

Thanks for reporting this! This is a known bug and we have a GitHub issue open here: https://github.com/AnalyticalGraphicsInc/cesium/issues/4327
I’ve linked to your forum post so we can notify you when we have a chance to look into it.

Best,

Hannah

Thanks Hannah!