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

Cache lightprobe generation in ligthtmap baking #82915

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

Conversation

reduz
Copy link
Member

@reduz reduz commented Oct 6, 2023

@reduz reduz requested a review from a team as a code owner October 6, 2023 14:15
scene/3d/lightmap_gi.cpp Outdated Show resolved Hide resolved
scene/3d/lightmap_gi.cpp Outdated Show resolved Hide resolved
@reduz reduz force-pushed the cache-lightprobe-generation branch 2 times, most recently from 8d24b01 to 22a6dcc Compare October 6, 2023 14:27
@Calinou Calinou added this to the 4.x milestone Oct 6, 2023
@reduz reduz force-pushed the cache-lightprobe-generation branch from 22a6dcc to c170c02 Compare October 6, 2023 14:42
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected.

Testing project: test_lightmap_preview_bake_4.x.zip

Time for a lightmap bake with Probe Subdiv set to 16 (i9-13900K + RTX 4090):

  • Cold cache: 7 seconds
  • Warm cache: 4 seconds

Some notes:

  • Creating a LightmapProbe invalidates cache (as expected).
  • Creating or removing a static object with UV2 doesn't invalidate cache (as expected, but I initially thought this wasn't feasible).
  • Moving a dynamic object then baking doesn't invalidate cache (as expected).

What I find unexpected is that when you restart the editor, the cache is lost (even if you save the scene after baking). This means you only get the warm cache benefit for subsequent bakes within a given editor session. I'd expect it to be able to persist the cache across restarts.

@jcostello
Copy link
Contributor

I expect to persist as well after the editor is restarted as well

@reduz
Copy link
Member Author

reduz commented Oct 7, 2023

@Calinou I fixed a bug, the cache should persist. Feel free to give it another try.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Probe generation caching now works across editor restarts.

However, it only seems to work if you've baked the same scene at least twice before exiting the editor. If you only bake it once, caching will not be effective when you reopen the editor and bake again without changing anything.

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