cesiumjs

How to Properly Render a Cone Entity in Cesium


I added a cone entity to the scene, but when my viewpoint gets close to the cone, parts of it disappear. How can I avoid this issue?

screenshot showing broken red segments of the cone

    const viewer = new Cesium.Viewer("cesiumContainer", { 
      infoBox: false 
    });
    
    const cone = viewer.entities.add({
      name: "cone1",
      position: new Cesium.Cartesian3.fromDegrees(119.999, 30, 200),
      cylinder: {
        topRadius:0,
        bottomRadius:4e6,
        length:8e7,
        slices:100,
        numberOfVerticalLines:6,
        material: Cesium.Color.RED.withAlpha(0.5),
        heightReference:Cesium.HeightReference.RELATIVE_TO_GROUND,
        outline:true,
        outlineColor:Cesium.Color.BLUE,
      },
    });

Here's a Sandcastle Demo


Solution

  • This issue can be resolved by setting the following code
    viewer.scene.logarithmicDepthBuffer = false;
    This is the reference link