Fix lightmap capture not applied in one octant

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.
This commit is contained in:
Per Melin 2024-03-08 12:17:50 +01:00
parent aef11a1427
commit 46610117d3

View file

@ -2053,7 +2053,7 @@ void RendererSceneCull::_update_instance_lightmap_captures(Instance *p_instance)
Vector3 inner_pos = ((lm_pos - bounds.position) / bounds.size) * 2.0 - Vector3(1.0, 1.0, 1.0);
real_t blend = MAX(inner_pos.x, MAX(inner_pos.y, inner_pos.z));
real_t blend = MAX(ABS(inner_pos.x), MAX(ABS(inner_pos.y), ABS(inner_pos.z)));
//make blend more rounded
blend = Math::lerp(inner_pos.length(), blend, blend);
blend *= blend;