Does three.js WebGPU support reverse z-buffer?

Does three.js WebGPU support reverse z-buffer? If so, should I use it instead of logarithmic depth buffer?

3 Likes

WebGPURenderer does not yet support reverse depth buffer. This feature has been implemented for WebGLRenderer but it is still incomplete (e.g. shadows are partly broken when using reversed depth buffer). You can track the progress here:

Once the implementation is stable and free from bugs, we port it over to WebGPURenderer. In the meanwhile, use logarithmic depth buffer if necessary.

3 Likes

Assuming reverse depth buffer is implemented in WebGPU bug-free, what reasons would there be to ever use logarithmicDepthBuffer?

If you have reserve-z, logarithmic depth buffer is obsolete.

Does logarithmicDepthBuffer:true in WebGPU disable early-Z testing, like it does in WebGL when writing to frag_depth? If so, will enabling reverse depth buffer in WebGPU allow for early z-testing in a similar fashion?

Yes, WebGPURenderer uses the same approach to write logarithmic depth values. By writing into gl_FragDepth (GLSL) or frag_depth (WGSL). This disables early-Z testing.

Reverse depth buffer does not rely on these built-ins so early-Z testing should work as expected.