GroundPrimitive Polygons Disappearing

I just upgraded my Cesium version from 1.15 to 1.24, and I wanted to take advantage of the terrain clamping of ground primitives. I have some very long polygons that I’m creating using PolygonGeometry as follows:

var groundPrimitive = scene.primitives.add(new Cesium.GroundPrimitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolygonGeometry({
polygonHierarchy: {
positions: positions
}
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)
}
}),
appearance: new Cesium.PerInstanceColorAppearance({
closed: true,
translucent: true
})
}));

``

As I zoom further out the the polygons appear to disappear below the terrain as you can see in the following screen captures:

Is this due to low resolution elevation data? Is there something I can do to keep the polygons from disappearing?

Thanks,

Rob

A couple of clarifications:

  1. Only portions of the polygons are “disappearing” as I zoom out from the globe (not entire polygons).
  2. This happens in both Chrome and Edge browsers.
    I’ve been digging through the forum and the API documentation.

I can’t tell if I’m doing something wrong or if this is a known issue/bug.

The same thing appears to happen if I create a polygon entity. I took the section of code to create a polygon from the Sandcastle Ground Clamping example and replaced the positions with a new set of positions. You don’t have to zoom out very far for the polygon to disappear.
The following should drop right into Sandcastle:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
url : ‘https://assets.agi.com/stk-terrain/world’,
requestWaterMask : true,
requestVertexNormals : true
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;

function drawPolygon() {
var e = viewer.entities.add({
polygon : {
hierarchy : {
positions: [new Cesium.Cartesian3.fromDegrees(-80.52240492379808,26.07276605035512),
new Cesium.Cartesian3.fromDegrees(-80.38142436812922,26.072221561466225),
new Cesium.Cartesian3.fromDegrees(-80.3813686168645,26.08386721144594),
new Cesium.Cartesian3.fromDegrees(-80.52234917227406,26.084411700334833)]
},
material : Cesium.Color.BLUE.withAlpha(0.5)
}
});

viewer.zoomTo(e);}

drawPolygon();

``

The only difference I see between this and the Sandcastle example is that I’m using “new Cesium.Cartesian3.fromDegrees”.

Am I doing something wrong?

Thanks for including the Sandcastle example! That made this problem really easy to reproduce.
This looks like a bug in Cesium to me. I’ve filed an issue on our GitHub so we can look into it: https://github.com/AnalyticalGraphicsInc/cesium/issues/4231

Best,

Hannah

Thank you, Hannah! I’ll be watching for any updates.