首页 / 浏览问题 / WebGIS / 问题详情
设置地下颜色之后。相机高于10000米。地下颜色会消失。
46EXP 2021年03月23日

使用产品:webGL 操作系统:win10 x64
数据类型: 文件型
问题详细描述:设置了地面透明scene.globe.globeAlpha。然后设置地下颜色scene.underGlobe.baseColor

相机高度小于10000的时候,显示正常。相机高度大于10000。地下颜色消失。显示了黑色。

1个回答

在官方例子页面http://support.supermap.com.cn:8090/webgl/examples/webgl/editor.html#S3MTiles_vector。添加如下能复现问题

        scene.undergroundMode = true; // 开启地下模式
        scene.undergroundDepth = 150;
        scene.underGlobe.baseColor = new Cesium.Color.fromBytes(92,103,74,255)
        scene.globe.globeAlpha = 0;

整体如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>矢量</title>
    <link href="../../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
    <link href="./css/pretty.css" rel="stylesheet">
    <script src="./js/jquery.min.js"></script>
    <script src="./js/config.js"></script>
    <script type="text/javascript" src="http://www.supermapol.com/earth/Build/Cesium/Cesium.js"></script>
</head>
<body>
<div id="cesiumContainer"></div>
<div id='loadingbar' class="spinner">
    <div class="spinner-container container1">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
    <div class="spinner-container container2">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
    <div class="spinner-container container3">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
</div>
<script type="text/javascript">
    function onload(Cesium) {
        //初始化viewer部件
        var viewer = new Cesium.Viewer('cesiumContainer');
        viewer.imageryLayers.addImageryProvider(new Cesium.BingMapsImageryProvider({
            url : 'https://dev.virtualearth.net',
            mapStyle : Cesium.BingMapsStyle.AERIAL,
            key : URL_CONFIG.BING_MAP_KEY
        }));
        var scene = viewer.scene;

//添加如下

        scene.undergroundMode = true; // 开启地下模式
        scene.undergroundDepth = 150;
        scene.underGlobe.baseColor = new Cesium.Color.fromBytes(92,103,74,255)
        scene.globe.globeAlpha = 0;
// end


        scene.shadowMap.darkness = 1.275;
        scene.skyAtmosphere.brightnessShift=0.4;
        scene.debugShowFramesPerSecond = true;
        scene.hdrEnabled = false;
        scene.sun.show = false;
        scene.lightSource.ambientLightColor = new Cesium.Color(0.80, 0.80, 0.795, 1);
        var position1 = new Cesium.Cartesian3 (-2322647.280384799,5386029.9142943295,10);
        //光源目标点
        var targetPosition1 = new Cesium.Cartesian3 (-2322406.966324683,5385931.743190132,30);
        var dirLightOptions = {
            targetPosition: targetPosition1,
//            color: new Cesium.Color(1.0, 1.1, 1.3, 1),
            color: new Cesium.Color(1.0, 1.0, 1.0, 1),
            intensity: 0.4
        };
        directionalLight_1 = new Cesium.DirectionalLight(position1, dirLightOptions);
        scene.addLightSource(directionalLight_1);


        var widget = viewer.cesiumWidget;
        $('#loadingbar').remove();
        try{
            //打开所发布三维服务下的所有图层
            var promise = scene.open('http://www.supermapol.com/realspace/services/3D-JuBuShuJu_Model_GuangZhouJuBuMian-BaiMo1/rest/realspace');
            Cesium.when.all(promise,function(layers){
                //设置图层的阴影模式
                scene.camera.setView({
                    //将经度、纬度、高度的坐标转换为笛卡尔坐标
                    destination : new Cesium.Cartesian3(-2323607.7945701713,5386182.530303348,2505814.811681112),
                    orientation : {
                        heading : 4.844795866469065,
                        pitch : -0.58125995096984,
                        roll :1.2504663970958063e-11
                    }
                });
                for(var layer of layers) {
                    layer.lodRangeScale = 1;
                    layer.style3D.fillStyle = Cesium.FillStyle.Fill_And_WireFrame;
                    layer.wireFrameMode = Cesium.WireFrameType.Sketch; // 草图模式
                }
            },
                function(e){
                if (widget._showRenderLoopErrors) {
                    var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
                    widget.showErrorPanel(title, undefined, e);
                }
            });
        }
        catch(e){
            if (widget._showRenderLoopErrors) {
                var title = '渲染时发生错误,已停止渲染。';
                widget.showErrorPanel(title, undefined, e);
            }
        }
    }
    if (typeof Cesium !== 'undefined') {
        window.startupCalled = true;
        onload(Cesium);
    }
    if (typeof Cesium !== 'undefined') {
        window.startupCalled = true;
        onload(Cesium);
    }
    </script>
</body>
</html>

46EXP 2021年03月23日
您好,这个问题我这边先测试一下,然后回复您
好的。。
这个是底层限制,当相机高度超过一万m的时候就不显示地下球,为了节省性能
...