godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.39k stars 19.24k forks source link

GPU Lightmap: Baking directional with physical lights causes static lights to have excessive amount of energy compare with no directional bake #85506

Open jcostello opened 7 months ago

jcostello commented 7 months ago

Godot version

v4.2.rc.custom_build [4c5a14845]

System information

Ubuntu with Nvidia 2060

Issue description

When physical lights are configured in the project and static lights are baked with directional, they receive a lot of energy compared with no directional bake

Direcional: Screenshot from 2023-11-29 10-29-06

No directional: Screenshot from 2023-11-29 10-29-28

Steps to reproduce

Use MRP

Set ligihts to phyisical in project configuration Bake lightmap with directional

For comparison: Set ligihts to non-phyisical in project configuration Bake lightmap with directional

Minimal reproduction project

lightmap.zip

Calinou commented 7 months ago

My guess is that bake_params.exposure_normalization isn't used where it should be in the directional lightmap baking shader. Here's an example where it's used correctly: https://github.com/godotengine/godot/blob/b3a0e077ebd29bc4e2456dea816b525b691932ab/modules/lightmapper_rd/lm_compute.glsl#L461-L531

jcostello commented 7 months ago

I added * bake_params.exposure_normalization to line 444 but that completelly eliminates direct light.