# Selective depth testing for cesium entities

**URL:** <https://community.cesium.com/t/selective-depth-testing-for-cesium-entities/8392>\
**Category:** CesiumJS\
**Created:** [June 23, 2019, 4:26pm UTC](https://community.cesium.com/t/selective-depth-testing-for-cesium-entities/8392 "2019-06-23T16:26:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffersonlee2000](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jeffersonlee2000](https://community.cesium.com/u/jeffersonlee2000)\
**Post date:** [June 23, 2019, 4:26pm UTC](https://community.cesium.com/t/selective-depth-testing-for-cesium-entities/8392/1 "2019-06-23T16:26:52Z")

</div>

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

![label_line.PNG](https://global.discourse-cdn.com/cesium/original/1X/2556829324b54961465301f798d89f2157d1b7eb.png)

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [June 28, 2019, 8:54pm UTC](https://community.cesium.com/t/selective-depth-testing-for-cesium-entities/8392/2 "2019-06-28T20:54:35Z")

</div>

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 ([https://cesium.com/ion-sdk/](https://cesium.com/ion-sdk/)) 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: [https://demos.cesium.com/vricon-geoint/](https://demos.cesium.com/vricon-geoint/)

You can read more about this Vricon partnership here: [https://cesium.com/blog/2019/06/04/vricon-partnership/](https://cesium.com/blog/2019/06/04/vricon-partnership/)
