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

[3.2] Reduce lightmaps file size. #46054

Merged
merged 2 commits into from
Feb 16, 2021
Merged

Conversation

JFonS
Copy link
Contributor

@JFonS JFonS commented Feb 15, 2021

A couple of commits that should help reduce the lightmap's file size:

  • Backport EXR compression support from master: this alone already makes a big difference, with EXR files being about 1/3 in size compared to their uncompressed equivalent.

  • Added options to reduce file size even further:

    These two options can be used independently or can be combined to get the smallest texture file size possible.

I changed the denoiser to work in a single buffer, reducing RAM usage, and also added the -mstackrealign flag in the denoiser compilation for MinGW builds. This flag helped fix a bug in Embree, so I want to see if it will also help with #45296.

@JFonS JFonS added this to the 3.2 milestone Feb 15, 2021
@JFonS JFonS requested a review from a team February 15, 2021 15:09
@JFonS JFonS requested a review from a team as a code owner February 15, 2021 15:09
doc/classes/BakedLightmap.xml Outdated Show resolved Hide resolved
scene/3d/baked_lightmap.cpp Outdated Show resolved Hide resolved
Comment on lines +111 to +112
if env["platform"] == "windows" and not env.msvc:
env_thirdparty.Append(CPPFLAGS=["-mstackrealign"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawnjelly
Copy link
Member

lawnjelly commented Feb 15, 2021

On a related note, you may be interested in this if you haven't seen it:
http://graphicrants.blogspot.com/2009/04/rgbm-color-encoding.html

I did have a little try at getting it to work but not much joy.

@JFonS JFonS force-pushed the cpu_lightmapper_disk branch from 599fab5 to 7932f3c Compare February 16, 2021 11:58
@JFonS
Copy link
Contributor Author

JFonS commented Feb 16, 2021

@lawnjelly Looks interesting indeed, but seems a bit too involved to get working... especially in 3.2.

I updated the PR according to the feedback. I also enabled sRGB usage for low dynamic range textures, which significantly reduces banding.

Added BakedLightmap.use_hdr and BakedLightmap.use_color properties
that can reduce the flie size of lightmap texture at the expense of quality.

Changed the denoiser to work in a single buffer, reducing RAM
usage. Also added the `-mstackrealign` flag in the denoiser compilation
for MinGW builds. This flag helped fix a bug in Embree, so I want to see
if it will help fix GH godotengine#45296.
@JFonS JFonS force-pushed the cpu_lightmapper_disk branch from 7932f3c to 56bf256 Compare February 16, 2021 12:20
@akien-mga akien-mga requested a review from Calinou February 16, 2021 12:32
@akien-mga akien-mga merged commit 77438f7 into godotengine:3.2 Feb 16, 2021
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

5 participants