-
-
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
Add half-pixel offset to lightmapper rasterization. #81872
Add half-pixel offset to lightmapper rasterization. #81872
Conversation
Add half-pixel offset to lightmapper to fix issues where the ray would be generated from the wrong spot corresponding to the pixel and causing light leaks. Fixes Issue godotengine#69126.
Might also help with #63437 in case someone wants to test it. |
Testing project: test_lightmap_preview_bake_4.x_1.zip
Testing project: test_lightmap_one_sided.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! The changes make sense. I haven't tested locally, but I trust that the testing from other reviewers was adequate.
Thanks! |
Cherry-picked for 4.1.2. |
Add half-pixel offset to lightmapper to fix issues where the ray would be generated from the wrong spot corresponding to the pixel and causing light leaks. Fixes Issue #69126.
As said in the issue and code comments, this is required so the lightmapper doesn't spawn rays from the very edge of the faces. It looks a bit hacky at first but there's a pretty solid reason behind it and as far as I can tell it fixes leaks in most scenarios I could find. Basically, by using this offset, the interpolated position the pixel shader receives will never be perfectly aligned at the edges of the faces but right on the middle of the pixel, which is what is usually desired.
Denoiser is recommended to be off when testing, as the current denoiser can cause light leaking on its own that doesn't exist in the noisy output due to the blurring.
Before
After
Before
After
(Lighting differences might be due to exposure adjustment or just less light leaking into the scene, but it's to be expected)
Testing out the fix in more scenes would be appreciated.
Bugsquad edit: