Hey, everybody. I create an entity in which I place PlaneGraphics. Then I create an ImageMetarialProperty and pass the path to my png or svg image. But if the entity is single, it blinks when I zoom or move the camera. When there are many objects everything is fine. Is there any way to fix this? I attach the code and video!
cesium.viewer.entities.add({
name: "Red plane with black outline",
position: new Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
plane: {
plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_Z, 0.0),
material: new Cesium.ImageMaterialProperty({
image: right,
transparent: true,
// color: new Cesium.Color(1.0, 1.0, 1.0, 0.9)
}),
dimensions: new Cesium.Cartesian2(1560000.0, 1561000.0)
}
});
cesium.viewer.scene.preRender.addEventListener(function () {
let cameraHeight = cesium.viewer.scene.camera.positionCartographic.height;
var newSize = 30000.0 * (cameraHeight / 2000000);
newSize = Math.max(newSize, 100.0);
let test = new Cesium.Cartesian2(newSize, newSize);
let minHeight = 1000000;
let maxHeight = 20000000;
cesium.viewer.entities.values.forEach((item) => {
console.log(item._plane._dimensions)
if (cameraHeight > minHeight && cameraHeight < maxHeight) {
item._plane._dimensions.setValue(test);
cesium.scene.requestRender()
}
if (cameraHeight > 1000000) {
item.show = true;
}else {
console.log(123123123)
item.show = false
}
})
})
Video: https://www.veed.io/view/ee4f3a02-5ea3-469b-b2c7-7ca97be7dbdb?panel=share