polyline eyeOffset-Z: better accuracy at high zoom?

1. A concise explanation of the problem you’re experiencing.

In our app we are having a lot of success with overlayed polylines as per this Sandcastle (I just use the point cloud as previously found its the most similar example to working within our app).

The solid line is drawn between real points in the world, and the dashed line is pulled towards the camera so it is no occluded by the model. However at high zoom the lines split.

Am I forgetting basic camera stuff when this is done with the points out of frame so close to the camera? Because small tweaks of the camera orentation/position cause the lines to merge and split it feels more like the camera position is more/less accurate at different positions/orentations.

I have also tried:

  • taking the position from the viewMatrix instead of the camera.position in case it is maintained to be more accurate,

  • transforming the points using the viewMatrix, translating toward the origin, transforming them back using the inverse of the view matrix,

would say same/similar results in these cases. So either I’m having a stupid moment or its just accuracy at some position/orientations?.. (or option C that’s not coming to mind? :slight_smile: )

Any thoughts would be greatly appreciated.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Sandcastle

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Removes the discontinuity of lines occluded by 3d model.

4. The Cesium version you’re using, your operating system and browser.

1.46, Chrome, Ubuntu

Hi Shane, are you trying to use this method so the polygon looks dashed when it’s behind the model? You should be able to use a depthFailMaterial to accomplish this:

viewer.entities.add({
polyline : {
positions : Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(samples),
followSurface : false,
width : 5,
material : new Cesium.PolylineOutlineMaterialProperty({
color : Cesium.Color.ORANGE,
outlineWidth : 2,
outlineColor : Cesium.Color.BLACK
}),
depthFailMaterial : new Cesium.PolylineOutlineMaterialProperty({ //replace this with your dashed material
color : Cesium.Color.RED,
outlineWidth : 2,
outlineColor : Cesium.Color.BLACK
})
}
});

``

You can see the ‘Sample line positions and draw with depth test disabled’ section of this sandcastle example: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Ground%20Clamping.html&label=All

Best,

Hannah

Works great - thanks Hannah!

Thanks,
Shane.