0
点赞
收藏
分享

微信扫一扫

《Cesium 进阶知识点》- 关闭天空盒,自定义背景图

艾米吖 2023-09-21 阅读 66

效果  

关键代码

1.代码第 4 行,初始化时配置 webgl.alpha 为 true;

2.代码第 8 行,不显示天空盒;

3.代码第 9 行,背景色透明;

const viewer = new Cesium.Viewer('cesiumContainer', {
    contextOptions: {
        webgl: {
            alpha: true
        }
    }
});
viewer.scene.skyBox.show = false;
viewer.scene.backgroundColor = new Cesium.Color(0,0,0,0);

4.css 设置,注意 #cesiumContainerviewer DOM id

#cesiumContainer {
    background-image:url(../assets/bg.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}
举报

相关推荐

0 条评论