Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: LightmapGI banding visible on baked lighting due to 8 bpc lossless compression being used by default (even with denoising enabled) #53436

Closed
Tracked by #56033
Calinou opened this issue Oct 5, 2021 · 8 comments

Comments

@Calinou
Copy link
Member

Calinou commented Oct 5, 2021

Godot version

4.0.dev (2fc31fd)

System information

Fedora 34, GeForce GTX 1080 (NVIDIA 470.57.02)

Issue description

A significant amount of banding is visible on direct baked lighting (even with denoising enabled). This applies to lights whose bake mode is set to Static rather than the default Dynamic, and becomes more noticeable when you disable bounces entirely. I suspect there's a precision issue somewhere in the compute shader used to bake the lightmap.
Edit: This is caused by lightmaps using Lossless compression by default instead of VRAM Compressed (or VRAM Uncompressed). Standard lossless and lossy compression does not support HDR – only VRAM compression, Basis Universal or the uncompressed storage modes do.

Enabling denoising does not improve the situation, since denoising isn't meant to combat banding anyway. Enabling the screen-space debanding filter doesn't resolve this issue either, as the banding is part of the lightmap texture itself.

GLES3 does feature bicubic lightmap sampling which can hide banding a little. Nonetheless, there's still a lot of banding in the lightmap texture that wouldn't be hidden by bicubic sampling once it's implemented in the Vulkan renderer.

Steps to reproduce

Real-time light in Vulkan (good)

light_vulkan_realtime

Fully baked light in Vulkan (bad)

lightmap_vulkan

GLES3 in 3.x (good)

lightmap_gles3

Minimal reproduction project

@williamd67
Copy link
Contributor

williamd67 commented Nov 1, 2021

I think this is caused by an incorrect setting for the compress mode of the lightmap texture. For the reproduction project is the lightmap data stored in 'test.lmbake'. This data contains a texture test.exr which compress mode is set to Lossless (PNG) which is a RGB8 format. This compress mode can be seen in the Import tab of the scene, when the test.exr texture is selected. The default setting for the compress mode is Video RAM which is a RGBE9995 format.

The first setting does not have enough precision causing the banding effect. The latter is much better and the banding is reduced.

The setting can be adjusted and the texture re-imported, after which the banding is reduced.

@williamd67
Copy link
Contributor

I did find another effect which is that the color between real-time light and bake-light differs. This can also be seen in the reproduction project. Maybe we should open a separate issue for that. Any way I will investigate those color differences.

@Calinou
Copy link
Member Author

Calinou commented Nov 1, 2021

See #53388 for the different color output between baked and real-time lights. I didn't make a comparison with Vulkan yet, but it's possible that a similar issue to GLES3 occurs there.

@Calinou Calinou changed the title LightmapGI: Banding visible on direct baked lighting (even with denoising enabled) Vulkan: LightmapGI banding visible on direct baked lighting (even with denoising enabled) Dec 17, 2021
@WilliamDeurwaarder-TomTom

I propose to close this issue as it is caused by an incorrect setting (see comment).

In case this explanation is not considered a solution, I like to understand what needs to be done further for this issue.

@Calinou
Copy link
Member Author

Calinou commented Dec 21, 2021

I can confirm that changing the compression mode to VRAM Compressed, VRAM Uncompressed or Basis Universal resolves the issue:

2021-12-21_18 48 50
2021-12-21_18 48 59
2021-12-21_18 49 09
2021-12-21_18 49 18

However, we should make sure that newly created lightmap textures automatically use the right compression setting (VRAM Compressed setting in this case). Therefore, we should keep this issue open for now 🙂

@Calinou Calinou changed the title Vulkan: LightmapGI banding visible on direct baked lighting (even with denoising enabled) Vulkan: LightmapGI banding visible on baked lighting due to 8 bpc lossless compression being used by default (even with denoising enabled) Dec 21, 2021
@KoBeWi
Copy link
Member

KoBeWi commented Jun 4, 2022

Needs updated MRP, the attached one is completely black in alpha 9 and spams errors.

@KoBeWi KoBeWi moved this to To Assess in 4.x Priority Issues Jun 4, 2022
@clayjohn clayjohn modified the milestones: 4.0, 4.x Jan 12, 2023
@clayjohn
Copy link
Member

this was fixed by #73136

@clayjohn
Copy link
Member

For future reference, the default will need to change from VRAM Uncompressed to VRAM compressed once we get betsy merged

@clayjohn clayjohn removed this from the 4.x milestone Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants