Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depth texture is unstable in post processing #11067

Open
bbbbx opened this issue Feb 3, 2023 · 8 comments
Open

Depth texture is unstable in post processing #11067

bbbbx opened this issue Feb 3, 2023 · 8 comments

Comments

@bbbbx
Copy link
Contributor

bbbbx commented Feb 3, 2023

Here is a screen record:

screenshot.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 bbbbx changed the title Depth texture is unstablein post processing Depth texture is unstable in post processing Feb 3, 2023
@ggetz
Copy link
Contributor

ggetz commented Feb 3, 2023

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.

@bbbbx
Copy link
Contributor Author

bbbbx commented Feb 3, 2023

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:

suspend.globe.update.mp4

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

with.model.mp4

@ggetz
Copy link
Contributor

ggetz commented Feb 3, 2023

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;?

@bbbbx
Copy link
Contributor Author

bbbbx commented Feb 3, 2023

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

log-depth-off.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

@ggetz
Copy link
Contributor

ggetz commented May 10, 2024

Also reported in #11972

@syzdev
Copy link
Contributor

syzdev commented Jul 16, 2024

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.

// Avoid tearing artifacts between adjacent frustums in the opaque passes
frustum.near =
index !== 0
? frustumCommands.near * scene.opaqueFrustumNearOffset
: frustumCommands.near;
frustum.far = frustumCommands.far;
uniformState.updateFrustum(frustum);

@jjhembd
Copy link
Contributor

jjhembd commented Aug 31, 2024

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.

@Ariakim-Taiyo
Copy link

I am having similar issues with the depth buffer.
It is causing a lot of artifacts when attempting to reconstruct world space positions, and it becomes very obvious when I convert said world space positions back into UV coordinates.
It also seems to be very imprecise at close ranges.
Example

2024-10-29.16-41-17.mp4
2024-10-29.16-40-08.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants