cesium
cesium copied to clipboard
Depth texture is unstable in post processing
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!
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.
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
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;
?
Here is a macOS 15.7 machine's WebGL report, Windows 10 above is same or better than it.
WebGL1 report:
WebGL2 report:
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
Also reported in https://github.com/CesiumGS/cesium/issues/11972
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
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.