-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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 Volumetric Fog VoxelGI updates #86023
Conversation
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.
Tested locally, it works as expected. I've also tested a larger scene with a single VoxelGI node and it still renders correctly.
Before
simplescreenrecorder-2023-12-11_11.40.20.mp4
After (this PR)
simplescreenrecorder-2023-12-11_11.45.19.mp4
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.
The heart of the fix seems correct, right now we detect whether the uniform is null or dependencies have been updated, but then only create the uniform set if it's null.
I'm guessing at some point in time we would have freed the uniform set maybe?
But freeing the uniform set before (re)creating it makes sense.
Setting dependencies as changed while we update those seems sound to me as well.
@bitsawer Could you rebase this PR just to make sure it still passes CI a few months later? Edit: Done myself. |
66609da
to
89d772a
Compare
Thanks! |
Cherry-picked for 4.2.2. |
The problem was that when VoxelGI volumes became visible in the camera or leave it, the active VoxelGI culling results were not updated to volumetric fog uniform sets. The updates only happened when toggling the enviroment off and on or resizing the windows, which forces a full update. More specifically, this volumetric fog uniform update code needs to be re-run every time when VoxelGI culling results change:
godot/servers/rendering/renderer_rd/environment/fog.cpp
Lines 857 to 864 in b94eb58
There are few similar volumetric fog update issues that I think might be caused by similar missing uniform (or some other) update, for example #83990 (the same workaround also works there, turning environment off and on or resizing the window).
The Volumetric Fog and VoxelGI interactions and uniform set handling received some work in #76437, #76550 and #77703, so it could be useful to get some feedback from @RandomShaper here. There might be a more elegant or efficient way to implement the update notifying logic, especially if there are other cases like #83990 that need to be also handled in the future, but this should fix the immediate problem.