-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Full screen quad depth buffer issues depending on camera settings #48202
Comments
The tutorial should be updated to explain that the sample code is only for cameras using perspective projection. And it should explain that the quad needs to be beyond the near plane so that it doesn't not get clipped. |
@clayjohn Thanks, I had guessed the sample might not work for orthogonal projections, but admittedly assumed That said, I'm still skeptical of the perspective case. I was (perhaps wrongfully) under the impression that this part of the shader would make sure the quad was in the right place:
It at least seems to work fine when the near clipping distance is small (0.05). Plus, it seems more like the quad is just moving further into the scene than I want it to. To prove this to myself, I put a couple objects underneath the plane I had in the original project and set the near value to 2. This is what I got: I tried adjusting the quad translation but that didn't do anything. However, adjusting the z-value assigned to
Interestingly, this seems to fix the issue regardless of the value I set for the near clipping distance (I assumed it would vary with the distance), provided I'm admittedly not entirely sure that I understand what is happening, as I'm somewhat new to shaders, but I'm questioning if it might be an off-by-one error, either in the engine or just as an oversight in the tutorial. Either way, hopefully this is useful information. Thanks again! |
I have a stack overflow question here: |
https://godotengine.org/article/introducing-reverse-z/
|
Likely related to #43575.
Godot version:
3.3.stable, Linux
OS/device including version:
Pop!_OS Linux 20.10, X11, Nvidia GTX 760, GLES3
Issue description:
Following the steps in the advanced post-processing tutorial for using a full-screen quad with the depth buffer, appears to work fine until camera settings are changed. With a perspective projection, increasing the near clipping distance creates a foreground area unaffected by the shader. With an orthogonal projection, only objects closer to the far clipping plane seem to be affected. The actual depth values also appear to be very different at similar distances
Steps to reproduce:
Create a simple scene with a full-screen quad as described in the tutorial linked above. Change the camera settings to see results like the following:
Minimal reproduction project:
OrthogonalDepthTest.zip
The text was updated successfully, but these errors were encountered: