cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Depth texture is unstable in post processing

Open bbbbx opened this issue 2 years ago • 6 comments

Here is a screen record:

https://user-images.githubusercontent.com/22176164/216549800-9f46cdf3-7315-4673-bd00-5abf7ed2759a.mp4

Sandcastle example: URL

Browser: Google Chrome 109.0.5414.120

Operating System: Windows 10 Version 21H2 (Build 19044.2486)

Any suggestions are welcome!

bbbbx avatar Feb 03 '23 08:02 bbbbx

Thanks for the detailed writeup @bbbbx!

I think I'm able to reproduce the same change in the depth texture after adjusting the camera. Is there any chance that the changes to the depth you're seeing is additional terrain tiles loading in after adjusting the camera? That looks like it could be the cause on my end.

ggetz avatar Feb 03 '23 14:02 ggetz

Thanks for response @ggetz

Maybe not be related to terrain tiles loading, depth texture is still "flickering", even if I suspend the globe LOD update:

https://user-images.githubusercontent.com/22176164/216645053-45a68aaa-073d-48d6-bf63-1dadede6b769.mp4

Also, the depth value of model has the same problem:

https://user-images.githubusercontent.com/22176164/216645709-0ea3eb4a-478a-4fe8-90fd-8fea25b16aa4.mp4

bbbbx avatar Feb 03 '23 15:02 bbbbx

Thanks @bbbbx. I do see some of the flickering, but not as drastic as what you're showing in your videos.

Would you mind taking screenshots of what you see webglreport.com? It might help determine what's going on.

Also do you see a difference when disabling log depth with viewer.scene.logarithmicDepthBuffer = false;?

ggetz avatar Feb 03 '23 16:02 ggetz

Here is a macOS 15.7 machine's WebGL report, Windows 10 above is same or better than it.

WebGL1 report: webglreport com__v=1

WebGL2 report: webglreport com__v=2

Here is a screen record when log depth is disable

https://user-images.githubusercontent.com/22176164/216659020-b719998c-d0be-4e91-bd64-2403a4208165.mp4

The "banding" artifact is gone, but the flickering is still there, and it seems the depth values precision is lower then before.

Sandcastle URL @ggetz

bbbbx avatar Feb 03 '23 16:02 bbbbx

Also reported in https://github.com/CesiumGS/cesium/issues/11972

ggetz avatar May 10 '24 13:05 ggetz

I'm not sure if this is related to the dynamic calculation of the near and far, this should be one of the few clues.

https://github.com/CesiumGS/cesium/blob/7b93161da1cc03bdc796b204e7aa51fb7acebf04/packages/engine/Source/Scene/Scene.js#L2451-L2457

syzdev avatar Jul 16 '24 10:07 syzdev

Quick update: The flickering seems to correlate with an instability in the calculation of the frustum near plane distance. In this example, panning the camera only 1m makes the near plane jump from 23m to 0.1m.

jjhembd avatar Aug 31 '24 14:08 jjhembd