-
-
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
Fix LightmapGI dynamic object lighting #77089
Fix LightmapGI dynamic object lighting #77089
Conversation
The fix seems sensible looking at surrounding code, but please amend the commit message to be explicit. "fix" doesn't really cut it :) |
43f7d5a
to
53903f0
Compare
Thank you for reviewing the pull request. I appreciate your feedback and have amended the commit message to provide more clarity and explicitness regarding the changes made. |
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. I'll let @clayjohn double check as the rendering expert (especially in case this pattern of error might be found somewhere else).
Does it work if you move the object's position in the editor to force update it's lighting? |
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.
Change looks good to me. It seems the bug was introduced by #44623 Looking at other uses of lightmap_captures makes it clear that this particular usage is reversed.
Testing locally it seems that you need to toggle the global illumination mode to make sure that the dynamic object receives dynamic lighting. So there is still something missing before we can close the linked PRs
I move it several times and it didn't seems to be affected by the probes |
See my comment above, I think something is wrong with the pairing code as well. I found that it worked after turning the GI mode to static and then back to dynamic. Also remember to bake with probes |
I already baked it with probes. I tried turning the Global Illumination mode from static to dynamic several times (dynamic still said only VoxelGI) and still I have the result of the pictures. Also I disabled and re enabled the LightmapGI node. Do I miss something? |
I found that hiding the LightmapGI node broke the pairing. For some reason the LightmapGI node isn't properly propagating the dirty flag to GeometryInstances. |
If you save the scene and reopen it will that get them to pair? I can't reproduce your issue. I'll look into fixing the pairing issue in a separate PR. |
I can push my project so you can check the issue |
@DearthDev https://github.com/jcostello/SponzaHD Here you are |
PS: Please do not nest quotes in replies as it makes the thread difficult to read. Only quote the exact text you are replying to. (Unfortunately, GitHub won't do this for you, so you have to edit the quoted text manually.) |
Upon reviewing the code in the debugger, everything appeared to be functioning properly. To troubleshoot the issue, I attempted to rebuild the light map. Subsequently, my screen displayed unexpected behavior and the Godot became unresponsive. After realizing that there were errors related to VoxelGI in the scene, I suspected that the scene might have been corrupted or damaged. Again, I think it's an issue with pairing. Then, I tried creating a new scene and baking a lightmap with all the same meshes. The dynamic lighting worked perfectly, However, I did observe some visual errors, which I attributed to the process of copying the directional light and world environment from the previous scene. It seemed that some settings in the world environment or camera attributes, such as exposure, were causing issues. The visual errors are unrelated to lightmap captures and resetting all the world environment settings and camera attributes settings fix all the visual errors. |
@DearthDev have you been able to get lighting from the probes? |
Yes, after making the new scene it worked fine. |
@DearthDev I recreated the scene and I notice the problem might be with reflection probes. I can't figure it out but when reflection probes are enabled in order for a dynamic mesh to have the lightmap probes light I have to enable the mesh first before the reflection probes. Can you try that? |
When playing the scene, objects are not receiving dynamic light (No reflection probe in this case to avoid the issue above) Edit: Moving the object after lauching the game applies the dynamic but if the object doesn't move at all it will receive no light until moves. It should be applied even if the object didn't move yet |
Message while baking. IDK if its relevant |
I've ran into that error in my personal projects. We know:
|
To me, those issues are related to this preventing dynamic light to work so could be fix on this PR. But lets hear @Calinou opinion |
My preference is to create the 3 suggested issues then merge this as-is. We shouldn't block a perfectly good bug fix just because it doesn't fix all bugs with the feature it touches. That is too much to expect from a contributor |
I agree and then we can have any discussion pertaining to each issue separately. |
Thanks! And congrats for your first merged Godot contribution 🎉 |
Congratz @DearthDev 😄 BTW can you create the issues for
I will create for the invalid probes that I have more information about it |
Cherry-picked for 4.0.4. |
fixes #57890.
potentially fixes #57131 too.