Fix lightmap captures not applied in one octant #89281
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.
GI from probe captures was not applied to dynamic objects in the (-,-,-) octant of the lightmap. If the object had traveled from a different part of the lightmap, it would simply not update anymore and kept whatever ambient light it had from before. If the object on the other hand came from outside of the lightmap into this octant, it would receive no ambient light at all.
The same bug also caused incorrect blending when the object is inside several overlapping lightmaps.
The bug lies in a blending factor for overlapping lightmaps. This factor is mostly cancelled out when there is only a single lightmap, except that the captured light is not applied at all if the blend is not greater than zero. The calculation of
blend
did not account forinner_pos
being in the [-1, 1] interval, which would causeblend
to become negative.