guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Bakery not correctly baking reflection probes #124

Closed pedropla closed 2 years ago

pedropla commented 2 years ago

When I bake using Bakery all my reflection probes get corrupted and appear as unbaked in Unity. I have to go through each manually and click bake for Unity to bake them. I saw some others on the discord discussing something similar as well.

This is on 2020.3.25

pedropla commented 2 years ago

Perhaps this is a duplicate of this issue: https://github.com/guycalledfrank/bakery-issues/issues/118

guycalledfrank commented 2 years ago

Any test project where I can reproduce would be helpful.

pedropla commented 2 years ago

I've emailed a repo to the email in your Unity Profile page. If I should use a different email let me know.

guycalledfrank commented 2 years ago

Seems to work on 2020.3.2, standard pipeline. I'll check 2020.3.25. Are you not on the standard RP?

image

pedropla commented 2 years ago

I'm on built in as well. I know it used to work for me but stopped a while back. I can bake any of them individually pressing the Unity bake button, but if I just press Render in bakery they all get unbaked again.

guycalledfrank commented 2 years ago

Hmm possibly some global project settings? Can you try to create a small project that does this? Apparently unitypackage doesn't show the whole picture. Also build target is useful to know. Some things work differently when it's Android vs PC.

pedropla commented 2 years ago

I've resent you an entire project repo. Note that the target platform is Android with texture compression set to ASTC in case that has anything to do with the issue.

guycalledfrank commented 2 years ago

Initial test on 2020.3.2/desktop: works OK. Installed 2020.3.25, desktop: works OK. Installed Android support for 2020.3.25, switched the project to Android, texture compression forced to ASTC: works OK.

image

I noticed there is "MLP test" in your project. Is it possible that MLP somehow interferes with the lighting data asset in the full project? Can you actually reproduce it on the project you've sent me?

pedropla commented 2 years ago

That is very strange indeed. I tried it on that same project and just tried it again now and it still doesn't seem to generate them correctly.

It did show the window that it was rendering each of the reflection probes but they are not rendered and they're not in the folder, even though the lightmap is: image

I show the lightmap there so you see it's not likely a file permission issue or it wouldn't be able to create the lightmap.

Here you can see the entire same project with different results than you have:

image

Ignore the MLP test, I had used that project to previously test an MLP issue and create a repo for that and then I stripped it clean and copied in all the bakery related files but I didn't bother renaming the folder. ha

How is the reflection probe being rendered? Is it with an api call to Unity? Is there any log of any error that it might be generating? If you let me know where in the code to add console logs I'll happily do it and give you more feedback.

Thanks

guycalledfrank commented 2 years ago

How is the reflection probe being rendered? Is it with an api call to Unity?

Yeah, it's just doing this:

image

You can see how it works in the Unity reference code:

https://github.com/Unity-Technologies/UnityCsReference/blob/3fcad4bbbea0455588843799c67861f7b9eb3825/Editor/Mono/Inspector/ReflectionProbeEditor.cs#L308

Just calls Lightmapping.BakeAllReflectionProbesSnapshots, which is an internal static method.

Bakery simply invokes it as well:

        var bakeFunc = typeof(Lightmapping).GetMethod("BakeAllReflectionProbesSnapshots",
            BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);

        bakeFunc.Invoke(null, null);

Thus if it doesn't work with Bakery, it doesn't work with that button too (?)

pedropla commented 2 years ago

When baking using that button it correctly bakes all the reflection probes. And, strangely enough, after I bake with that button it did let me bake them with bakery.. I haven't tried clearing them and baking with Bakery, but in any case I know the "hack" around it. So, I'm going to put it down to some obscure Unity bug that's just too strange for me to waste any more of your time with.. Thanks for all your help along the way!

guycalledfrank commented 2 years ago

Very wierd o_O