-
-
Notifications
You must be signed in to change notification settings - Fork 35.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
SsaoPass: artifacts with depth buffer #17865
Comments
Can you please share you camera parameters in this topic? |
|
It seems the mentioned effect of using a depth texture is first issue to solve and unrelated to SSAO. I've create a live example that demonstrate the precision issue here: https://jsfiddle.net/u06qpbgz/ As you can see, as soon as you disable the depth texture, the most obvious glitches go away. Although certain box intersections are still a bit shaky. |
Yes, this is unrelated to SSAO, only related to the usage of a renderTarget. The little sharkfins when switching off the depthTexture are ok considering the camera near value. |
I solved the depth issue by rendering the depth data to a separate render target, using Anyway, should i create a new issue for the beauty output related problem? |
After some investigation I think I know what's causes this issue. The problem is that in WebGL 1, you can only use So when using As showed in the following fiddle, you can use a WebGL 2 rendering context instead and then use https://jsfiddle.net/gt1h5k8L/ Since the usage of |
@Mugen87 I found that setting the format of the depth texture to |
BTW: |
I haven't encountered any issues with this depth texture setup. As far as I can tell, WebGLTextures already contains code for handling DepthStencilFormat and it also seems to handle stencil buffers correctly. Stencil + Depth Texture support was added in #9368 which came after #8596 but didn't close or reference the latter, although @Bryce-Summers reported that this PR fixed his CSG problem. Depth/Stencil management was also further enhanced by #9774. I'll check again if there are any problems with using stencil + depth texture and will report back later.
That's true. I can only speak for myself, but to me 24-bit depth appears to be sufficient. |
This flew over my head: why can't we use |
Thanks for this bit. I suppose #8596 was just overlooked. Let's close it now. |
From the spec:
Interesting! So it seems depending on the implementation, you might get more precision with certain texture types on certain platforms. However, using a floating point texture seems the most reliable way to achieve 32-bit depth precision. |
I tested the Stencil Buffer + Depth Texture feature and can confirm that everything works as expected. I also tested
Good point; as long as WebGL 2 is supported on the device, 32-bit The spec also says that I think |
I'm not sure about this statement and would prefer to do some tests with mobile devices first. According to other precision issues in this repo (e.g. Right now, I tend to go for WebGL 2 and |
Sure, that sounds reasonable. My intention is just to provide another opinion on the matter. |
The actual issue that's causing the mentioned artifacts is now well understood. The optimal parameterization with best performance and quality depends on the specific use case. Closing for now since the engine can't make this choice automatically for the application. |
Description of the problem
The SSAO example shows several artifacts when i change the camera settings. In particular, the camera near clipping plane value is critical therefore. For a project of mine i need a small camera near value, but when setting up a useful value z-fighting artifacts occure. Both on the beauty and the ssao output mode.
When switching off the depthTexture of beautyRenderTarget in SSAOPass.js, the beauty output mode delivers a useful rendering again, but then the depth information is missing of course.
Another attempt was to use the logarithmic depth buffer on THREE.WebGLRenderer, but the reimplementation 2f9bd63 seems not to contain a normalization regarding the logarithmic nature of the depth buffer.
I'd like to know how to achieve a good effect with the logarithmic depth buffer. What is the data type and the value range of the depth texture and why is only the x (or red) channel of interest. Next i'd like to know why the rendering quality seems to increase when i switch off the depthTexture (as seen in code above) for the beauty pass?
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
Depth / Stencil Bits: [24, 8]
extensions WEBGL_depth_texture and EXT_frag_depth are available
The text was updated successfully, but these errors were encountered: