guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Lightmap stops working after baking reflection probes and entering play mode #143

Closed artnas closed 1 year ago

artnas commented 1 year ago

Hey. Baking a lightmap works as expected, but after baking reflection probes, it only works in edit mode. Play mode makes the lightmap fully black.

This is a scene, not a prefab

Baked lightmap (looks the same in play mode)

image

After baking reflection probes this appears

image

Baked lightmap with reflection probes (Edit mode)

image

Baked lightmap with reflection probes (Play mode)

image

Am I missing something here or is this a bug?

guycalledfrank commented 1 year ago

Possibly related to some very recent Unity editor bug, this was addressed in v1.95:

image

Are you sure you're on the latest version? Hovering over the blue "Bakery" text will show you the version number.

artnas commented 1 year ago

I just downloaded the asset today (v1.95) and patched it using "Check for patches". I'm on Unity 2021.3.15

Seems like this is the same issue as this: https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-95-rtpreview-released.536008/page-130#post-8737716

The lightmaps indeed dissapear after entering play mode image

guycalledfrank commented 1 year ago

Weird... I can't reproduce it on Sponza, but I don't have the exact Unity version. Can you try if this works:

Will this work?

artnas commented 1 year ago

I created a new scene, added a reflection probe and baked it. Scene with reflection probe

image

Then took the new lighting data asset and selected it in my main scene

Main scene, edit mode

image

Main scene, play mode

image

The result seems to be the same

guycalledfrank commented 1 year ago

OK, I don't know then. Can you make a simplified copy of this project (e.g. just this scene, no material textures, scripts, etc... actually can even skip most props except for the walls) and send it to me for debugging? (just make sure it opens/bakes/shows the bug)

guycalledfrank commented 1 year ago

Reproduced it today on another project in Unity 2021. Can you try the latest patch now?

Or, just add this one line to the Start() of ftLightmapsStorage.cs:

image

https://github.com/guycalledfrank/bakery-csharp/commit/d7f0c9cf79c3bcfcf2c3c6de6434cba34800874f

It seems that since Unity 2021, if you have a lighting data asset in the scene (which is created if you have light/reflection probes), then there is a chance it will try to reload it after Awake() (but before Start()).

artnas commented 1 year ago

It works. Thank you!