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.x] Add a Preview Bake button for quick iteration with BakedLightmap #45237

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jan 16, 2021

When using the Preview Bake button instead of Bake Lightmaps, low quality settings will be used instead of settings from the BakedLightmap node. A node configuration warning will be displayed besides the BakedLightmap 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.

Editor top bar

Node configuration warning

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 project, Preview Bake (0:00:38) was about 3 times faster than a "final" bake (0:01:48) with the default BakedLightmap settings.

By default, Preview Bake uses:

  • Low quality for baking.
  • 1 bounce, unless the BakedLightmap node is set to 0 bounces (in which case it uses 0 bounces as well).
  • Low quality for dynamic object capture.
    • You can disable dynamic object capture entirely in the Project Settings if you don't need it for previewing purposes.

The preview bake settings above can be adjusted in the Project Settings. These are project settings so that different team members always use the same preview settings for consistency.

Comparison between Preview Bake and "final" bake

@Calinou Calinou added this to the 3.2 milestone Jan 16, 2021
@Calinou Calinou requested a review from JFonS January 16, 2021 17:55
@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch 2 times, most recently from 4878206 to 683ac6a Compare January 16, 2021 18:20
@Calinou Calinou requested a review from a team as a code owner January 16, 2021 18:20
@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch from 683ac6a to b74b490 Compare January 16, 2021 19:08
@Zireael07
Copy link
Contributor

If I understand it correctly, I can use preview bake if I want to in production (because real bakes will likely take too long on my hardware), this is just a suggestion/reminder?

@Calinou
Copy link
Member Author

Calinou commented Jan 16, 2021

If I understand it correctly, I can use preview bake if I want to in production (because real bakes will likely take too long on my hardware), this is just a suggestion/reminder?

Yes, the preview bake is still saved and can be used in an exported project. That said, for your use case, I'd recommend you change the BakedLightmap node properties instead of relying on Preview Bake.

@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch from b74b490 to 0de095c Compare January 16, 2021 21:35
scene/3d/baked_lightmap.cpp Outdated Show resolved Hide resolved
scene/3d/baked_lightmap.cpp Outdated Show resolved Hide resolved
@Calinou Calinou requested review from a team as code owners March 12, 2021 12:26
Base automatically changed from 3.2 to 3.x March 16, 2021 11:11
@aaronfranke aaronfranke modified the milestones: 3.2, 3.3 Mar 16, 2021
@akien-mga akien-mga modified the milestones: 3.3, 3.4 Mar 26, 2021
@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch from 0de095c to 9977c32 Compare May 6, 2021 00:05
@Calinou
Copy link
Member Author

Calinou commented May 6, 2021

I rebased and moved the preview_bake property to BakedLightmapData as requested by @JFonS. I tested it again, it works as expected 🙂

Maybe we could even add a .preview. infix to the saved file name, so baking in preview mode doesn't overwrite a "final" bake you may already have.

I'm not sure how to handle that part without accidentally exporting those preview bakes in the final PCK (if they weren't removed by the user). I think preview bake data could even be stored in .godot/, but I'd leave that for a future PR.

@Chaosus Chaosus modified the milestones: 3.4, 3.5 Nov 8, 2021
@akien-mga akien-mga modified the milestones: 3.5, 3.x Jul 2, 2022
@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch 2 times, most recently from 677f1b6 to 5f35055 Compare June 27, 2023 10:46
@akien-mga akien-mga changed the title Add a Preview Bake button for quick iteration with BakedLightmap [3.x] Add a Preview Bake button for quick iteration with BakedLightmap Jun 27, 2023
@Calinou Calinou force-pushed the editor-add-lightmap-preview-bake branch from 5f35055 to 51af3e7 Compare August 11, 2023 13:01
When using the Preview Bake button instead of Bake Lightmaps,
low quality settings will be used instead of settings from the
BakedLightmap node. A node configuration warning will be displayed
besides the BakedLightmap 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 was about 3 times faster
than a "final" bake with the default BakedLightmap settings.

The preview bake settings can be adjusted in the Project Settings.
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.

6 participants