Skip to content

Bug: Cesium Globe添加ElevationRamp材质,显示有错误 #141

@JinghengHuang

Description

@JinghengHuang

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材质

截图
b348ea445af6dbd1f280d1fe381ccaa

系统信息
OS: Win10 X64
Browser: Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions