viewer.scene.globe.depthTestAgainstTerrain disturb pick?

in my project,l attempt to pick 3dtiles with( scene.pick firstly 、scene.pickposition secondly)to pick point on 3dtiles.

when viewer.scene.globe.depthTestAgainstTerrain= true, scene.pick、scene.pickposition work rightly.

when viewer.scene.globe.depthTestAgainstTerrain= false,scene.pick、scene.pickposition result is different from before,what happend?

The documentation on pickPosition (https://cesiumjs.org/Cesium/Build/Documentation/Scene.html#pickPosition) states that it uses the depth buffer to compute the picked position. Disabling depth testing against terrain causes the globe to no longer write to the depth buffer (so it no longer occludes objects) but that means it will also no longer be picked up in the pickPosition pass.

Does that make sense?

when depthTestAgainstTerrain= true,the ployline i drawed overlaps earth surface,how can i solve it?

another question, is there have one way to set material state(ztest =false or other)?

在 2019年4月24日星期三 UTC+8上午1:15:46,Omar Shehata写道:

Are you able to share a Sandcastle example and/or a screenshot of what I mean? When testing in the drawing on terrain example:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Drawing%20on%20Terrain.html

The polyline on terrain looks the same regardless of whether terrain depth test is on or off (except then picking doesn’t work correctly when it’s off).

It is possible to disable depthTest on materials since it’s a property of renderState (https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Renderer/RenderState.js#L127-L129) but this is not currently exposed in the public API, see https://github.com/AnalyticalGraphicsInc/cesium/issues/7203.

If you can describe your use case in more detail and how having more control over the depth test will be useful to you, it can help get support for this feature. Feel free to share this here in this thread or in the GitHub issue.

在 2019年4月24日星期三 UTC+8下午11:31:16,Omar Shehata写道:

Thanks for the Sandcastle example!

It looks like the disappearing parts are fixed by setting clampToGround: true on the polyline.

Another thing you could do is disable depth test on that one individual polyline. You can effectively do this by using a depthFailMaterial that has the same material as the regular polyline. One more way to fix it is to give the polyline points a height a little above the ground (about 1000 seemed to work well in this demo).

I did open a bug report for this though: https://github.com/AnalyticalGraphicsInc/cesium/issues/7783

Thanks again for reporting this.

when depthTestAgainstTerrain= false ,line also have problem。link another question : Comparisons with polyline ,the point don’t have option clamptoGround 。

在 2019年4月26日星期五 UTC+8下午10:05:30,Omar Shehata写道:

If you want to clamp a point to the ground you can set the height reference to be either relative to ground (and set a height 0) or make the height reference CLAMP_TO_GROUND.