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

Add Use Color and Use HDR properties to LightmapGI #50574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jul 17, 2021

Follow-up to #50572.

Colored lightmaps and HDR lightmaps can be disabled to reduce file size, which is useful for mobile/web platforms.

This closes #50569 and closes #50570.

File size comparison in a given 3D scene:

  • HDR enabled, color enabled (default): 9.80 MB
  • HDR enabled, color disabled: 3.32 MB (3× smaller)
  • HDR disabled, color enabled: 902 KB (11× smaller)
  • HDR disabled, color disabled: 471 KB (21× smaller)

scene/3d/lightmap_gi.cpp Outdated Show resolved Hide resolved
@reduz
Copy link
Member

reduz commented Jul 30, 2022

I think this is a misunderstanding of how lightmaps work in Godot 4.0, but may be good to improve the usability on this.

@Calinou
Copy link
Member Author

Calinou commented Jul 30, 2022

I think this is a misunderstanding of how lightmaps work in Godot 4.0, but may be good to improve the usability on this.

What do you mean by misunderstanding? Changing an image's pixel format will reduce its size on disk. I don't think there's anything more involved 🙂

@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 9, 2023
@clayjohn clayjohn modified the milestones: 4.1, 4.x May 23, 2023
@Calinou Calinou changed the title Add Use Color and Use Hdr properties to LightmapGI Add Use Color and Use HDR properties to LightmapGI Oct 6, 2023
@Calinou Calinou force-pushed the lightmapgi-add-grayscale-ldr branch from bf0a669 to e4c6327 Compare October 6, 2023 22:31
@Calinou
Copy link
Member Author

Calinou commented Oct 6, 2023

Rebased and tested again, it works as expected. The file size differentials are even greater now, since we can use lossless WebP for LDR lightmaps instead of PNG 🙂

@Calinou
Copy link
Member Author

Calinou commented Jul 12, 2024

Rebased and tested again, it works as expected. Note that this will benefit from #93440 when using large lightmaps and Use HDR disabled, as to sidestep the WebP format limitation of 16383×16383 pixels. This will be especially relevant after #94243.

Colored lightmaps and HDR lightmaps can be disabled to reduce file size,
which is useful for mobile/web platforms.

File size comparison in a given 3D scene:

- HDR enabled, color enabled (default): 9.80 MB
- HDR enabled, color disabled: 3.32 MB (3× smaller)
- HDR disabled, color enabled: 902 KB (11× smaller)
- HDR disabled, color disabled: 471 KB (21× smaller)
@Calinou Calinou force-pushed the lightmapgi-add-grayscale-ldr branch from e6f7a08 to 316627a Compare July 12, 2024 00:39
@BlueCube3310
Copy link
Contributor

Some things to consider:
Directional lightmaps will not work with non-hdr formats since the SH coefficients require a storage format that supports negative values,
Grayscale HDR will only affect the size of the exr image, not the imported one,
Non-hdr lightmaps work best for indirect (dynamic) lighting, direct (static) will usually exceed the maximal value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants