-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Screen depth artifacts on mobile (iOS / Android) #3197
Comments
maybe it needs
|
Added that to the top of the PS shader, but still the result is the same on mobile. |
how about |
Added it but still the same. We thought it may be some precision issue, we even rendered to a render target on another example and messed with the texture formats to increase precision but still the same issue. |
I tried the example on Google Pixel 3A, Android 11, and also iPhone XR on 14.5, and cannot see any banding there. |
So issue seems to persist, tested on the following devices:
All produce the same result, interestingly when switching to WebGL 1.0 the issue is resolved. Any idea why the same shader produces a different output? We are about to release an open alpha of our open world game, it would be great if we could solve this. On the same device/OS/browser, WebGL 1.0: WebGL 2.0: |
Presuambly there is a bug in the |
Although then I would expect the bug to happen on desktop too under WebGL 2. |
This may be related: mrdoob/three.js#18696 |
Yeah, I thought so. Initially I thought something with the screen size may be the issue but I wasn't able to reproduce on desktop emulating mobile screen sizes ( pixel ratio > 1). |
I seem to be able to fix this by overriding the screenDepth.frag chunk and editing:
to:
|
Confirmed, that indeed fixes the issue. Many thanks @willeastcott for the find! |
For anyone coming across this and until the fix is added to the engine, you can do the following before using the
|
The fix for this is now deployed so you can remove the workaround from your application code. 😄 |
A simple shader that calculates depth height on a plane, using the screen to world depth difference, produces visible banding on mobile.
Here is on desktop:
Here is on Android 10, Samsung Galaxy S10:
Here is on an 2020 iPad, iOS 14.3:
The shader code is pretty simple:
Project sample: https://playcanvas.com/editor/scene/1164740
It seems like a texel size / resolution issue, though we were unable to find the exact fix by overriding the internal screen depth chunk methods.
The text was updated successfully, but these errors were encountered: