You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that when baking lightmaps, random rays miss the geometry and cause the interior of closed spaces to be illuminated by environment light.
Godot with DEBUG_TEXTURES enabled in lightmapper_rd.cpp.
Example scene
a) basic 3D scene with solid color for background, ambient and reflected turned off for clarity
b) lightmap gi node with different solid color for environment, denoiser off, use texture off
c) omnilight with yet another color in the center
d) basic blender cube with normals pointing inside
Results
Before bake:
After bake:
Although the geometry is closed on all sides, a lot of light from the environment gets in and hits the faces. This only happens in the “light_secondary” step. The green color of the environment is set from LightmapGI settings.
2_light_primary_0.exr
4_light_secondary_0.exr
Box inside box
The situation changes a bit when the above cube is placed inside a larger one. In Blender, it looks as follows:
After bake:
You can see that fewer rays missed the geometry, but despite the thick walls surrounding the cube, environment leaks still occur (green).
Switching Environment in LightmapGI to “Scene” gives this result: environment still appears, but consistent with the WorldEnvironment setting (blue).
Increased exposure:
Source
This section of lm_compute.glsl is most likely responsible for adding color of the environment:
When you turn off the line 534 all the green environment from baked ligtmap disappears. Naturally, this causes the environment to be completely ignored, so it is not a solution. The question remains why and in what cases trace_result == RAY_MISS, if we are talking about closed spaces (and even closed spaces inside other closed spaces).
No green dots anywhere:
4_light_secondary_0.exr after commenting line 534:
Can still replicate light leakage but with less noise
boxa:
boxb:
Note: boxb has backface culling enabled on the larger outside wall for some reason, I didn't modify the models and am running a freshly built Godot editor from the master branch.
Tested versions
System information
Windows 10 - Godot v4.3.beta.custom_build.daa81bbb7d - Vulcan (Forward+) - Geforce GTX 960
Issue description
Info
It seems that when baking lightmaps, random rays miss the geometry and cause the interior of closed spaces to be illuminated by environment light.
Godot with
DEBUG_TEXTURES
enabled inlightmapper_rd.cpp
.Example scene
a) basic 3D scene with solid color for background, ambient and reflected turned off for clarity
b) lightmap gi node with different solid color for environment, denoiser off, use texture off
c) omnilight with yet another color in the center
d) basic blender cube with normals pointing inside
Results
Before bake:
After bake:
Although the geometry is closed on all sides, a lot of light from the environment gets in and hits the faces. This only happens in the “light_secondary” step. The green color of the environment is set from LightmapGI settings.
2_light_primary_0.exr
4_light_secondary_0.exr
Box inside box
The situation changes a bit when the above cube is placed inside a larger one. In Blender, it looks as follows:
After bake:
You can see that fewer rays missed the geometry, but despite the thick walls surrounding the cube, environment leaks still occur (green).
Switching Environment in LightmapGI to “Scene” gives this result: environment still appears, but consistent with the WorldEnvironment setting (blue).
Increased exposure:
Source
This section of
lm_compute.glsl
is most likely responsible for adding color of the environment:godot/modules/lightmapper_rd/lm_compute.glsl
Lines 532 to 535 in 40b4130
When you turn off the line 534 all the green environment from baked ligtmap disappears. Naturally, this causes the environment to be completely ignored, so it is not a solution. The question remains why and in what cases
trace_result == RAY_MISS
, if we are talking about closed spaces (and even closed spaces inside other closed spaces).No green dots anywhere:
4_light_secondary_0.exr
after commenting line 534:Steps to reproduce
Minimal reproduction project below.
Minimal reproduction project (MRP)
environment-pollute.zip
The text was updated successfully, but these errors were encountered: