Cesium去掉黑色星空背景并透明的方法

为了使Cesium与整个网页的背景融合,需要去掉Cesium的黑色星空背景,具体方法如下:

1
2
3
4
5
6
7
8
9
10
viewer.scene.skyBox.destroy();
viewer.scene.skyBox = undefined;
viewer.scene.sun.destroy();
viewer.scene.sun = undefined;
viewer.scene.moon.destroy();
viewer.scene.moon = undefined;
viewer.scene.skyAtmosphere.destroy();
viewer.scene.skyAtmosphere = undefined;

viewer.scene.backgroundColor = new Cesium.Color(0, 0, 0, 0);

参考链接

  1. Scene Background Transparent,by cesium dev.