WebClient-JavaScript
WebClient-JavaScript copied to clipboard
Bug: Cesium Globe添加ElevationRamp材质,显示有错误
trafficstars
Bug描述 为viewer.scene.globe添加ElevationRamp材质,显示有错误,跟下面的底图混杂在一起
重现步骤 使用CesiumTerrainProvider添加地形,使用如下代码添加材质:
const elevationRamp = [0.0, 1.0];
let getColorRamp = (selectedShading) => {
const ramp = document.createElement("canvas");
ramp.width = 100;
ramp.height = 1;
const ctx = ramp.getContext("2d");
const grd = ctx.createLinearGradient(0, 0, 100, 0);
grd.addColorStop(elevationRamp[0], "#000000"); //black
grd.addColorStop(elevationRamp[1], "#ffffff"); //white
ctx.fillStyle = grd;
ctx.fillRect(0, 0, 100, 1);
return ramp;
}
const minHeight = -100.0; // approximate dead sea elevation
const maxHeight = 3000.0; // approximate everest elevation
let shadingUniforms = {};
let material = Cesium.Material.fromType("ElevationRamp");
shadingUniforms = material.uniforms;
shadingUniforms.minimumHeight = minHeight;
shadingUniforms.maximumHeight = maxHeight;
shadingUniforms.image = getColorRamp('elevation');
viewer.scene.globe.material = material;
运行,即可重现
预计结果 正常显示globe材质
截图

系统信息 OS: Win10 X64 Browser: Chrome
好的 问题我们已经确认 已安排进研发计划中
This is an automatic reply, your message has been received.I will read and reply the e-mail ASAP, sorry for any inconvience.黄靖珩,Huang Jingheng