-
-
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
Support shadow mapping with reverse Z #29770
Comments
Another problem with shadow mapping - needs to flip compare function inside shader programs. reverseZ pretty unstable because required to change everything that use depthTexture and compares depth manually. |
@CodyJasonBennett
|
Yes, the depth range is inverted. Any NDC math will also need to be adjusted for the [0, 1] range like it would for WebGPU. |
Also of interest is how |
Description
To repro, modify
examples/webgl_shadowmap.html
by passingreverseDepthBuffer: true
into theWebGLRenderer
constructor.To get anything to render at all, you will also need to add
renderer.getContext().clearDepth(0)
(see my comment in #29579).After these modifications, the demo looks okay except that there are no shadows.
Solution
Ideally shadow mapping is supported without requiring clients to write any extra code, since
DepthBuffer
inWebGLState
already flips the depth function & depth clear value at a low level. I have not yet been able to find the missing piece.Alternatives
Alternatively, maybe the onus is on the applications to handle this in the onBeforeShadow hook?
Additional context
No response
The text was updated successfully, but these errors were encountered: