While rendering some fairly basic primitives, I’m getting a strange artifact that looks like there’s something slicing through the geometries.

With terrain on, a similar thing happens, but it’s more obvious as the terrain appears to cut through the 2D geometry too.

It appears as a line whose width and angle are dependent on the position of the camera. The width of the line seems to increase as the gets higher (or as I middle-click pan up and tilt down), it’s always perpendicular to the direction of the camera across the plane of the ellipsoid, and as I zoom in it gets further away.
Do you know what this might be? Have we set something up incorrectly?
We’re creating the geometries like:
  var poly = new Cesium.GeometryInstance({
    geometry: new Cesium.PolygonGeometry({
      polygonHierarchy: { positions: vertices },
      height: height
    }),
    id: args.id,
    attributes: {
      color: Cesium.ColorGeometryInstanceAttribute.fromColor(DEFAULT_COLOR)
    }
  });
Then wrap that in a primitive:
    new Primitive({
      geometryInstances: poly,
      appearance: new Cesium.EllipsoidSurfaceAppearance()
    });
    scene.getPrimitives().add(primitive);
             
            
              
              
              
            
            
           
          
            
            
              I’ve done some work cleaning up our primitive creation, but the problem remains. We now create geometry with:
new GeometryInstance({
    id: parseInt(args.id),
    geometry: new Cesium.PolygonGeometry({
      polygonHierarchy: {positions: vertices},
      height: minTerrainHeight + altitude,
      extrudedHeight: minTerrainHeight + altitude + extrusionHeight
    })
  });
And primitives with:
    if (!is3d) {
      appearance = new Cesium.EllipsoidSurfaceAppearance();
    } else {
      appearance = new Cesium.MaterialAppearance({closed: true, flat: true});
    }
    appearance.material.uniforms.color = color;
The artifact doesn’t appear to affect the 2D geometries with the EllipsoidSurfaceAppearance.
             
            
              
              
              
            
            
           
          
            
            
              Hi Oliver,
Your code is OK.  This is a known-issue with translucent objects due to how we eliminate z-fighting for massive view distances.  Opaque objects do not have this artifact.  If you are curious about the details, see these slides (Slides 29 and 30 in particular):
Cesium: The Platform for 3D Geospatial
We can minimize the artifact a bit more by reducing frustum overlap, but fully eliminating it in the general case is hard.  Recently, I almost solved it with stenciling, but it didn’t turn out as expected.  I hope to think about it again, but it will be a few months out.
As for the screenshot with terrain, Kevin may have more to add.
Patrick