Disabling depth test for some entities

Hello,
I'd like to disable the depth test for certain entities with absolute positioning (not attached to the ground).

Ideally, I would like to do something like:
polygonEntity = cesiumViewer.entities.add({
    polygon: {
              hierarchy: cesiumCartesian,
              perPositionHeight: true,
              material: Cesium.Color.GREEN.withAlpha(0.5),
              renderState: {
                    depthTest: {enabled: false}
              }
   }
});

Can anyone tell me what would be the recommended way of doing this?
Many thanks,
Alexandrina

Hello Alexandrina,

Why do you need to disable depth test for this polygon?

Best,

Hannah

Hello,

I need to make certain entities (polygons and polylines) visible at all times. This includes them being visible even if they are hidden by other entities. For this, eye offset does not really seem to work.

I thought the solution would be to set the depth test to false and to either:

  1. add the visible-at-all-times elements to the scene last, with the hope they will be drawn last or

  2. create a different scene and draw that last (if possible in Cesium)

If you have a better suggestion, I would welcome it!

Alexandrina

I have a use case as well that would be solvable by turning on depth test per entity. I have terrain on and a bunch of cylinders that I want to be obscured by the terrain but I also have a mouse pick label showing the lat/lon at the mouse position. The label gets hidden inside the terrain that could be solved by turning off depth test for just the label.

We have an issue written up to improve label and billboard visibility when depthTestAgainstTerrain is enabled here: https://github.com/AnalyticalGraphicsInc/cesium/issues/2694
I think that will be the better solution for the case you described

-Hannah

Hello,

depthTestAgainstTerrainis not a good option for us, as we are working with Cesium 3D Tiles, and we need to draw 3D entities that are always visible on top of the 3D tiles.

As mentioned above, one option is to disable depth test. Alternatively, another solution we envisaged is to modify the entities positions at every camera move, by re-projecting them so the Z is very close to the camera, but they appear to be at the “correct” 3D position.

Both solutions are rather ad-hoc, we would prefer to go with a proper Cesium approach, if there is one. Could you please tell me if Cesium has a solution that you advise?

Regards,

Alexandrina

Bumping this thread for 2018 requests. I would also like to have control over whether particular entities participate in depth testing against terrain. In general, I want most entities to participate. However, I have some lines that represent purely graphical links and which I want to remain visible even if there is terrain in the way.

Thanks,

Jacob

Hi all,

The issue #2694 mentioned in this thread has just been closed and may resolve your issue. Look for the change in the next release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.

Thank!

Gabby