Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JohnHenryEden opened this issue Apr 12, 2022 · 2 comments
Open

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

JohnHenryEden opened this issue Apr 12, 2022 · 2 comments

Comments

@JohnHenryEden
Copy link

JohnHenryEden commented Apr 12, 2022

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

@JohnHenryEden JohnHenryEden changed the title Bug: Globe添加 Bug: Globe添加ElevationRamp材质,显示有错误 Apr 12, 2022
@JohnHenryEden JohnHenryEden changed the title Bug: Globe添加ElevationRamp材质,显示有错误 Bug: Cesium Globe添加ElevationRamp材质,显示有错误 Apr 12, 2022
@ParnDeedlit
Copy link
Member

好的 问题我们已经确认 已安排进研发计划中

@JohnHenryEden
Copy link
Author

JohnHenryEden commented Apr 26, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants