Fix Volumetric Fog VoxelGI updates #86023
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.