-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Shadow Normal Offset Bias #17260
Comments
I just came across this when messing around with shadows and from my experience, depth bias plus a normal offset as described above can give very good results with almost zero peter-panning. It should be fairly easy to implement as it's really just about adding the normal vector onto the 3D position of the fragment which is shaded (with some form of weighting the length of the offset). Also, this type of offset should be included in all light types, not just directional light sources. |
I'll see if I can get this implemented |
Any progress with this? |
At this point I think it may be better to work in the 4.0 branch, btw. |
@reduz I ran into some trouble with calculating the offset distance and haven't had much time to work on it since then. But the implementation should basically work like this:
It's mostly just a few lines of code in the shader and maybe a small adjustment on the c++ side (shader inputs). |
@CptPotato Could you upload your work in a branch somewhere? Thanks in advance 🙂 |
I don' t understand, does not Godot do this already with the normal bias? |
@reduz as far as I know it doesn't. Godot seems to only uses a depth bias (also based on the surface angle) but it only offsets the depth. The proposed method changes the sampling position by offsetting it away from the sufface (in 3d) before reading from the shadow depth map. The big difference is that you can eliminate self-shadowing even at very shallow angles. |
- Made shadow bias size independent, so it will remain when changing light or camera size. - Implemented normal offset bias, which greatly enhances quality. - Added transmission to subsurface scattering - Reimplemented shadow filter modes Closes godotengine#17260
Normal Offset is a better way to eliminate self-shadowing with much less to virtually no peter panning:
video explanation: https://web.archive.org/web/20160602213857/https://www.dissidentlogic.com/old/video/Techniques/NormalOffsetShadows_0001.wmv
Note: Godot's "Normal bias" seems to be slope bias, and it introduces a lot of peter panning.
The text was updated successfully, but these errors were encountered: