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 a Preview Bake button for quick iteration with LightmapGI #80518

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

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 11, 2023

When using the Preview Bake button instead of Bake Lightmaps, low quality settings will be used instead of settings from the LightmapGI node. A node configuration warning will be displayed
besides the LightmapGI node to inform the user that the bake was done in preview mode. This preview bake warning is persisted to storage to make teamwork easier.

This helps iterate quicker on a scene's lighting since you don't need to wait as much time to see results.

On a simple test scene, Preview Bake is about 3 times faster than a "final" bake with the default LightmapGI settings (if denoising is not the bottleneck). This metric will vary depending on CPU and GPU speed, as the baking process is performed on the GPU but denoising is performed on the CPU.

The preview bake settings can be adjusted in the Project Settings.

This also prints a message with the effective quality settings before beginning the lightmapping process.

Testing project: test_lightmap_preview_bake_4.x.zip

Preview Bake

image

Preview bake result

Note

Tangents are a bit broken on this scene, so there are artifacts that would usually not appear.

4 seconds to bake.

Screenshot_20240118_203800 webp

"Final" bake result

16 seconds to bake.

Screenshot_20240118_203828 webp

@Zireael07
Copy link
Contributor

Note that as mentioned on the 3.x PR, you can use the preview bake in your projects if your computer is too weak to handle the full bake.

@Calinou Calinou force-pushed the editor-add-lightmapgi-preview-bake branch 2 times, most recently from f6148ed to 4691061 Compare August 18, 2023 09:49
@verypleasentusername
Copy link

is this implemented?

@YuriSizov
Copy link
Contributor

@verypleasentusername No, this PR is still very much open.

@Calinou Calinou force-pushed the editor-add-lightmapgi-preview-bake branch from 4691061 to 28e5f04 Compare January 18, 2024 19:38
@Calinou
Copy link
Member Author

Calinou commented Jan 18, 2024

Rebased and tested again, it works as expected.

  • Add support for texel scale multiplier, which defaults to 0.5 (half resolution on each axis for preview bakes). This speeds up bakes a lot without having to disable denoising or directional baking.
  • Change the default maximum number of bounces for preview bakes to 2, which looks significantly closer to high bounce counts compared to 1. The reduced texel scale makes it more viable.
  • Removed toggle for denoiser and directional, as denoising is now very fast and directional impacts visuals too much to be worth toggling for preview bakes.

When using the Preview Bake button instead of Bake Lightmaps,
low quality settings will be used instead of settings from the
LightmapGI node. A node configuration warning will be displayed
besides the LightmapGI node to inform the user that the bake
was done in preview mode. This preview bake warning is persisted
to storage to make teamwork easier.

This helps iterate quicker on a scene's lighting since you don't
need to wait as much time to see results.

On a simple test scene, Preview Bake is about 3 times faster
than a "final" bake with the default LightmapGI settings
(if denoising is not the bottleneck). This metric will vary depending
on CPU and GPU speed, as the baking process is performed on the GPU
but denoising is performedon the CPU.

The preview bake settings can be adjusted in the Project Settings.

This also prints a message with the effective quality settings
before beginning the lightmapping process.
@Calinou Calinou force-pushed the editor-add-lightmapgi-preview-bake branch from 28e5f04 to 0b22b12 Compare January 24, 2024 15:16
@ARez2
Copy link
Contributor

ARez2 commented Aug 13, 2024

Could this be merged?

@Calinou
Copy link
Member Author

Calinou commented Aug 13, 2024

Could this be merged?

4.3 is currently in release freeze, so new features can only be merged in 4.4 at the earliest.

In the meantime, you can decrease Texel Scale before baking and increase it again after baking. This is the single largest contributing factor to bake times in my experience.

@ARez2
Copy link
Contributor

ARez2 commented Aug 13, 2024

Yep! That's what I am doing. Good to hear that this will be considered for 4.4 though!

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.

Add a "Preview Bake" button for LightmapGI for quick preview bakes
5 participants