SsaoPass: artifacts with depth buffer
See original GitHub issueDescription 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.
this.beautyRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBAFormat,
// depthTexture: depthTexture,
// depthBuffer: true
} );
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
- r110
- r103
Browser
- All of them
- Chrome
- Firefox
OS
- Windows
- macOS
- Linux (on my linux installation on the same intel hd-gpu powered laptop there are no issues)
Hardware Requirements (graphics card, VR Device, …)
Depth / Stencil Bits: [24, 8] extensions WEBGL_depth_texture and EXT_frag_depth are available
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (8 by maintainers)
Top GitHub Comments
Sure, that sounds reasonable. My intention is just to provide another opinion on the matter.
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.