-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Fix directional LightmapGI being too dark with static lights #61910
Fix directional LightmapGI being too dark with static lights #61910
Conversation
I think we need to dig a little deeper into the meaning behind those coefficients. The lighting still doesn't match. In the image you posted you can see that with this PR the faces facing left are significantly brighter than when using dynamic lights. To me this indicates that the problem lies somewhere else and we need to do the work to uncover what the problem is a fix it at source. CC @JFonS |
@jcostello This is an unrelated issue. Please open a new issue with a minimal reproduction project attached. |
Static Directional seems to be just slightly brighter than Dynamic Directional. |
Bumping to 4.x. I don't think this is the right fix and I don't want to introduce arbitrary scaling factors into the codebase without first investigating why they may be needed |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Is this PR dead? Or is it superseeded? |
I belive directional light have to be fixed since beside it bakes darker, it has artifacts |
I'd like to clarify at first I haven't exactly gotten the entire grasp of how the spherical harmonics encoding works, but I believe I have enough to justify this PR's choice of the 8.0 value enough so the fix is merged. The two chunks of relevant code to evaluate here are: godot/modules/lightmapper_rd/lm_compute.glsl Lines 408 to 420 in 571cd0e
godot/modules/lightmapper_rd/lm_compute.glsl Lines 516 to 528 in 571cd0e
The first chunk belongs to the direct light computation step of the lightmapper. This is fairly straightforward: rays are not casted at random but rather traced directly to the light sources. The result is added with this coefficient of The second chunk belongs to the indirect light (bounces) step of the lightmapper. Here an the average result is computed from rays traced at random, which is why it opts to multiply the additional light divided by That indicates however the resulting indirect light is added with a coefficient of However, there's likely some underlying meaning to these coefficients chosen so I'll be taking a look at the resources @reduz used for implementing this to try to understand their origin better. However, as far as fixing things in the short term, I think we're good to merge this PR for now. As it stands there's some other fundamental core issues with the lightmapper that will take a longer time to fix and it'd be preferrable to at least make this feature not broken for now. |
As an addendum, I'd probably take out the comment entirely as there's no need to do this empirically, as the same constant can be found elsewhere in the code or link back to this PR instead. |
The brightness now matches dynamic lights (indirect light baked only) when Directional is enabled. Co-authored-by: Priyansh Rathi <techiepriyansh@gmail.com>
b543bba
to
7831eed
Compare
Rebased and tested again, it works as expected:
Testing project: test_lightmap_preview_bake_4.x_2.zip |
Seems that the directional bake introduces artifacts because fo the normal calculations. I can't remember if there is an issue for that |
The picture you posted above does indeed look pretty buggy. If there isn't already a bug report, can you open one? |
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 good to me given the discussion in the PR!
I didn't flag for cherrypicking as it will result in a very obvious physical change
To be fair, the imported scene's normals themselves are weird (likely due to Godot's OBJ importer - I think the source OBJ file itself is fine). Directional lightmaps just make that issue more noticeable. |
I will open a Issue. Directional generate this weird alien like artifacts |
If you don't mind, where did you get the original model? |
https://github.com/Calinou/game-maps-obj/blob/master/redeclipse/octavus.obj |
Thanks! |
Have you opened the issue yet? If not, I'll open it, as the issue seem to have also cropped up in the Abandoned Spaceship demo. |
@atirut-w I didnt yet. If you can open up an issue for me. I tried to replicate it in a small MRP but I couldn't. It only happen to me in bigger scenes like sponza |
Please continue the discussion about the bug in #82307. |
The brightness now matches dynamic lights (indirect light baked only) when Directional is enabled. Thanks @techiepriyansh for the suggestion 🙂
The brightness of lightmapping for lights marked as dynamic is unchanged by this PR.
I ended up using an even stronger multiplier (
(24 / 3.0) = 8.0
). Static directional lightmapping now matches dynamic directional lightmapping exactly.This closes #49936.
Preview
Dynamic
Static