-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
DepthTexture: change default type to UnsignedIntType #24019
Conversation
I think we have decided to use That said I've noticed on more than one occasion that users run into the same issue like you but can't find a solution by themselves. Using However, if we want to head for quality, using |
@wmcmurray Could you give |
@mrdoob Both |
The difference in depth precision varies from device to device. So yes, it is possible that you don't see a difference between |
Lets use |
Reconsidering this issue: Hence, I think the PR is fine as it is. |
Thanks! |
Description
I noticed depth precision issues (horizontal banding + z-fighting) when rendering my project with post-processing (using WebGLRenderTargets) starting at very short distances (10 - 15 meters, where 1 unit = 1 meter), and those issues did not happen when rendering the same scene directly to canvas !
So I investigated, and it turns out setting a DepthTexture with the
UnsignedIntType
type intorenderTarget.depthTexture
fixed my issues. Precision issues only appear at much greater distances now (as expected) and exactly where they start appearing when rendering directly to canvas.About this PR
So I changed the default to⚠️
UnsignedIntType
because I believe defaults should give best results out of the box, but I don't know what I'm doing, I didn't test anything beyond my project, and I don't know the implications of this change(also updated the docs + bits of code that seemed relevant)
This example: https://threejs.org/examples/webgl_depth_texture.html helped me to visualize different types, just zoom out until the meshes are barely visible and you should notice banding with
UnsignedShortType
.