Labels getting inside of the terrain when depthTestAgainstTerrain is activated

Hello there.

I was having some trouble trying to prevent my labels from getting inside the terrain when I found this topic.

This is the sandcastle to check what the thread suggests. Basically using “heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,”.

But I just realised this only solves the problem when you are tracking an specific entity, as soon as you dont track it, it is inside of the ground again, like in this sandcastle.

Images of example:

Is there anything to do to prevent this? I have been trying with

          disableDepthTestDistance: Cesium.Number.POSITIVE_INFINITY,
          translucencyByDistance: new Cesium.NearFarScalar(4e6, 1.0, 8e7, 0.0),

but I would love to apply something “smarter”.

Thanks in advance!

Hi there,

I would typically recommend using disableDepthTestDistance in this case. Can you elaborate on what you’re looking for in a “smarter” solution?

Hi there, thanks for the reply.

Sorry for not answering faster, I couldnt read it before.

My problem with that is that using disableDepthTestDistance makes the label to be visible through the other side of the earth.

With something smarter i meant for example allowing viewer.scene.globe.depthTestAgainstTerrain but only for certain things. For example, in my case it would be awesome to only activate depthTestAgainstTerrain with some cylinders i have since they are partially inside the Earth Ellipsoid.

I actually think it would be awesome to have something like that, maybe making depthTestAgainstTerrain per entity instead of for all the viewer? I dont know…

To sum up: my problem is I have 2 cylinders (umbra and penumbra) that are partially inside of the earth and i need to activate depthTestAgainstTerrain as they suggested me here Any way to do a cone without base? .
This leads to all my labels and points that are on earth to be a little bugged like you could see in my screenshot.