godotengine / godot

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

LightmapGI doesn't take CameraAttributes into account when baking indirect light in lightmaps (and only partially for direct light) #74139

Open Calinou opened 1 year ago

Calinou commented 1 year ago

Godot version

4.0.rc6

System information

Fedora 37, GeForce RTX 4090 (NVIDIA 525.85.05)

Issue description

LightmapGI doesn't take CameraAttributes into account when baking indirect light in lightmaps (and only partially for direct light, i.e. when using Static bake mode).

DirectionalLight3D bake mode set to Dynamic

Regardless of the presence of a CameraAttributes resource in the LightmapGI's properties, this is the result after baking.

Screenshot_20230301_015822

DirectionalLight3D bake mode set to Static, LightmapGI with CameraAttributesPhysical

This works as expected, but changing exposure parameters then baking again doesn't affect light brightness at all even after rebaking lightmaps (be it aperture, shutter speed, ISO or multiplier).

Also note that using a CameraAttributesPractical results in the same lighting, which is unexpected.

Screenshot_20230301_020238

DirectionalLight3D bake mode set to Static, LightmapGI without CameraAttributesPhysical

This is overly bright as expected (which shows that the presence of the CameraAttributes is taken into account by LightmapGI somehow).

Screenshot_20230301_020248

Steps to reproduce

Minimal reproduction project

physical_light_camera_units_lightmap.zip

clayjohn commented 1 year ago

I'll take a deeper look soon. But it doesn't look like there is a bug here. The Camera attributes that is used by GI (both Lightmap and Voxel) is only used for adjusting the dynamic range when baking. At render time, the exposure will be adjusted to match the CameraAttributes that is used at render time.

You want the bake-time exposure to be as similar to the render-time exposure as you can to reduce banding.