Selective depth testing for cesium entities

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

I'm trying to create a measuring tool. When you select 2 points on the map, a PolyLine is drawn between them, and a Billboard is spawned detailing the line.

Let's say there's a mountain (from a 3d tile) between the 2 points. To make sure that the line is visible as it travels through the mountain, I set the PolyLine's depthFailMaterial to the same as its normal material.

However, if there's a billboard between the 2 points, the line also cuts through the billboard. I don't want this to happen.

Is there a way to achieve this task? (the line will render through the 3d tile terrain, but not billboards).

I have attached a screenshot of the situation above (the distance text is from a billboard, not a label. I am willing to switch it to a label if required though).

Cesium 1.58 Chrome 75


Are you able to share a minimal Sandcastle code example of your setup here? I wonder if an easier solution would be just using the pixelOffset or eyeOffset on the billboard/label so it doesn’t intersect the line.

Also, we do have a set of measurement tools ( that are going to be part of the ion platform soon (they’re currently sold as an enterprise plugin). There’s a live demo of it in this showcase we recently did with Vricon:

You can read more about this Vricon partnership here: