Search Unity

Bakery - GPU Lightmapper (v1.65) [RELEASED]

Discussion in 'Assets and Asset Store' started by guycalledfrank, Jun 14, 2018.

  1. Nolaloth

    Nolaloth

    Joined:
    Apr 12, 2019
    Posts:
    2
    Hello i have little problem with sharing scene with other members of my team. Only one station has bakery plugin and we would like to be able to view baked lightmaps on the scene on the other stations that dont have bakery plugin. We were trying to send those 5 scripts that u wrote in FAQ but that doesnt help. Any help?
     
  2. Nolaloth

    Nolaloth

    Joined:
    Apr 12, 2019
    Posts:
    2
    Ok we found solution. The problem was because lightmaps weren't in scene folder.
     
    guycalledfrank and Dawie3565 like this.
  3. Lt-Hamster

    Lt-Hamster

    Joined:
    Feb 19, 2013
    Posts:
    6
    The pop cans come from a single obj file and the floor pieces from a separate obj file. Each of the meshes have unique UV set from each other and there are no Lightmap Group components.

    It's just odd, when I pull them out of the empty parent object, they bake as expected.
     
    guycalledfrank likes this.
  4. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    58
    Overwrote the existing asset with the GitHub version, but now facing another problem:Overwrote the existing asset with the GitHub version, but now facing another problem:

     

    Attached Files:

  5. BUDU_KRATOK

    BUDU_KRATOK

    Joined:
    Jan 3, 2011
    Posts:
    30
    Hello!
    Is there any w/a or patch for this old issue? Unity3d 2018.2.20f1, prefab with baked lightmap, runtime Instantiate works fine on editor but broken at build.
    I tried to set lightmap settings "LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional" at Start and at scene lightmap settings but it doesn't help.

    Editor:


    Build:



    Bakery directional mode "None" and "Dominant direction", compression for lightmaps to "None", no mipmaps, no asset bundles, BakeryLightmaps added to Preloaded assets, with and without "allow HDR" at cameras.

    I think I missed something in this thread, some settings maybe, but I can't figure out what exactly :(
     
  6. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    946
    Yeh it says DX11 in my title, im using RTX2080. Seems consistent :( I managed a unity lightbake last night, went not too badly on this new card, but Id love to try bakery with it :)
     
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    It is! Shouldn't work like that. If you can send me a test scene to reproduce the problem, it'll definitely help.

    Are UVs OK on this palm object? Looks a bit like they're non-existent/broken.

    Take a look at the shader stripping section in graphics settings: https://docs.unity3d.com/Manual/class-GraphicsSettings.html#stripping
    Try enabling all lightmapping options there.

    Do you get the null tex error even on example scenes or just the one you have? Tried updating the driver?
     
    BUDU_KRATOK likes this.
  8. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    298
    Since updating to the latest version of Bakery, Now the same scene that worked fine before has the issue:
    The base models look fine, but the lower LOD levels are super bright. If you look at the screenshot attached, you can see the closer buildings are lit fine, but the farther ones are super bright.
     

    Attached Files:

  9. BUDU_KRATOK

    BUDU_KRATOK

    Joined:
    Jan 3, 2011
    Posts:
    30
    guycalledfrank likes this.
  10. MadmanEpic

    MadmanEpic

    Joined:
    Apr 13, 2019
    Posts:
    2
    I'm getting this message any time I try to bake light probes. Normal lightmapping works great.

    (I'm running off of a GTX 960 4GB on Unity 5.6.5p4.)
     
  11. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Hi, Arthur! Recently I've been thinking that if I can bake all point light with it's intensity into a channel of shadowmask?

    Further more, I would want to bake sky visibility mask(like an AO) and indirect visibility mask caused by directlight, pointlight visibility and finally shadowmask as R, G, B, A in shadowmask map. Is that possible?

    This is because I want to make indirect caused by point lights change intensity according to time. And to make color shifts of indirect of directlight between day and night.

    I think this is or will be a typical workflow for some mobile game.
     
    Last edited: Apr 13, 2019
    guycalledfrank likes this.
  12. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Hi, I find that the intensity of directlight in baking is rgb * intensity in ".bin" but know little about the following process. Is there a way to use it to match a pbr workflow to make sure I'm using the right intensity?
     
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    I think there might an issue where asset settings are not applied to lightmaps if you switch windows when the bake is almost finished. I'll look more into that, but for now check if the bright lightmap asset type is not set to "Lightmap". If so, set it and click apply.

    This is very weird. Does it happen on example scenes (e.g. Sponza) too? Does it also happen in L1 light probe mode (can be set in Experimental settings)?

    Not just the shadowmask, but with attenuation? There is no built-in option to do that, but you can get it with some scripting... I can write some example code for you.
    What is the reason behind such map though?

    Baking a white sky light will give you exactly that.

    Baking a white directlight in Indirect mode will give you exactly that.

    It is, but this particular arrangement of stuff and channels is very custom and specific to your project. You can make a script that changes lighting settings and runs the bake, then puts all generated maps into the channels.

    If you're in Linear colorspace and light intensity is linear (this is usually stated in the bottom part of Bakery light component UIs), it should be straightforward. Regular Unity color pickers are sRGB, so final color is pow(sRGBcolor,2.2)*intensity
     
    liudian208 likes this.
  14. killmebboy

    killmebboy

    Joined:
    Mar 18, 2018
    Posts:
    6
  15. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    guycalledfrank said: Not just the shadowmask, but with attenuation? There is no built-in option to do that, but you can get it with some scripting... I can write some example code for you.
    What is the reason behind such map though?

    -edit.
    After some thoughts, I think attenuation could be replaced by an exclusive hdr color.
    I thought it would be best for my project to:
    1.bake pointlight color to hdr lightmapColor. ( easy with bakery)
    2.bake sky visibility to shadowmask's channel R. ( need workflow support for bakery)
    3. bake indirect of direct light to shadowmask's channel G. ( need workflow support for bakery)
    4. bake direct shadowmask to channel B ( easy with bakery)

    As you can see,
    we may have to bake three times and do a lot of texture combinations.
    It would be so much appreciated if you can teach me some example code, so I can make it a auto workflow :D!

    Here is my situation, I am in a mobile team working on a MMORPG, we have tens of maps that are as big as 2km, we use shadowmask mode of course. We are trying this new workflow which is mask(visibility) oriented, so we can make pointlights turned off when it's daylight time, and shift lightmap color as the weather changes.
     
    Last edited: Apr 15, 2019
    guycalledfrank likes this.
  16. MadmanEpic

    MadmanEpic

    Joined:
    Apr 13, 2019
    Posts:
    2
    Switching to L1 seemed to fix it, thanks. The sample scene seemed to work fine with Legacy lighting probes, so I'm not sure why L1 fixed it, but hey, I'm not complaining.
     
    guycalledfrank likes this.
  17. Dawie3565

    Dawie3565

    Joined:
    Dec 30, 2018
    Posts:
    68
     
  18. Dawie3565

    Dawie3565

    Joined:
    Dec 30, 2018
    Posts:
    68


    a lot of speedtree assets have bad UVs ... the issue has been reported to Gaia DEV already...
    Just my feeling, fixing the tree in .spm workflow is not easy to deal with, .. I apologize to any Unity staff who may read this with all respect[/QUOTE]
     
    Last edited: Apr 15, 2019
    guycalledfrank likes this.
  19. Softelectro

    Softelectro

    Joined:
    Oct 9, 2013
    Posts:
    22
    Hello,
    I have made some test to use Bakery instead Enlighten and it's give very good result.
    But i've got some questions:
    • In Enlighten, I changed some ScaleInLightmap factors to increased the resolution of some object. But with bakery it's not the same value. I need to multiply by five or more with same "textel per unity" parameter (= 40). Is it normal?
    • When I add a "BakeryLightmapGroupSelector" script, all my tweaked (scaleInLightmap) need to be redone. Is it a way to avoid this like in Enlighten with the "Baked Tag" parameter?
    Thanks for your answers
     
    guycalledfrank likes this.
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Sorry for the late reply - I saw your PM as well. I'm currently away from my PC for a few days, so can't test the package right away. It would help if you can select the MissingReference error and tell me the line number where it happens.

    I will! Still need a few days to get back to my PC though. For now please check the FAQ, the "how do I bake via script" section. You should be able to extend this code to the one that will change the settings/toggle the lights the way you need.

    Bakery and Unity use different atlas packing code, so there can be a difference. Don't forget to use Checker Preview to make sure the resolution is right before baking :)

    Do you mean the scale values inside a group yield different results, so you need to retweak them? What is "baked tag"?
     
    liudian208 likes this.
  21. ojgang

    ojgang

    Joined:
    Oct 22, 2012
    Posts:
    3
    Hello,
    I am getting this error in unity 2018.3.8
    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

    from where i can have the patch?
     
  22. Softelectro

    Softelectro

    Joined:
    Oct 9, 2013
    Posts:
    22
    Hello,

    Ok, this is what we do to compare Enlighten and Bakery results.

    The "bakedTag" in LightmapParameter permit to group certain objects on same lightmap(s) with the same bakedTag ID.
    We can't find the same checker, that we have before added the "BakeryLightmapGroupSelector" script, regardless all parmeters available (resolution, pack atlas, original UV, ...). So we need to retweak objects.
     
  23. ArtR

    ArtR

    Joined:
    Sep 27, 2011
    Posts:
    47
    Hey all,
    Does anyone have any idea why I constantly get this issue where "enlighten" gets stuck when trying to "combine enlighten" with the bakery bake?
    Regards!
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Gave you repository access, please check PM.

    Huh, I didn't know that.
    I think the difference you experience is related to the fact that
    - In automatic packing mode, scale just acts as size multiplier over Texels Per Unit value;
    - In grouped mode all packed rectangles are normalized relative to lightmap size, so scale acts more like a priority; because everything inside one group has to fit in one atlas, if one object gets larger, others may get smaller.

    "Waiting for Enlighten" thing? It just literally waits for regular Unity bake to finish. Are you sure you want to do that?
     
  25. Dawie3565

    Dawie3565

    Joined:
    Dec 30, 2018
    Posts:
    68
    hello
    Any progress update for xatlas roadmap ? do you think perhaps decal roadmap could be solved with this :)
     
  26. ArtR

    ArtR

    Joined:
    Sep 27, 2011
    Posts:
    47
    Well I mean the combine enlighten real-time GI with Bakery option that you have added to the plugin. Apologies, the correct label for the option is " Combine with Enlighten real-time GI "
     
  27. yang-yu

    yang-yu

    Joined:
    Mar 8, 2013
    Posts:
    21
    Import the package will cause unity crash, even i delete the bakery file from the disk, the unity still crash. Unity version 5.6.4p4, and the crash log in the mono.dll can't trace.
     
  28. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Will be there in v1.6.
    I'm on vacation right now away from PC until 25th.

    Decals have completely different problems, namely:
    - workflow/UI.
    - optimization (redundant verts/faces).
    I'm also not sure if it should be a part of Bakery, it's kinda a separate asset.

    Yeah, and it does just that. First, runs a normal Enlighten bake (affected by normal Unity lighting settings), then runs Bakery.
    This is only useful when you want some lights to be Bakery-baked, and some affect GI in realtime. It was originally requested by a person who wanted to bake low resolution Enlighten lights that could be switched at runtime plus high quality Bakery sky/area lighting.

    Unity should never crash when importing any package, I have no power over the importing process. Maybe your download is corrupt?
    Maybe check these links:

    https://forum.unity.com/threads/error-while-importing-package-couldnt-decompress-package.15851/

    https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-55-released.536008/page-50#post-4289701
     
    ArtR likes this.
  29. Softelectro

    Softelectro

    Joined:
    Oct 9, 2013
    Posts:
    22
    That's confirme my guess.
    The bakedTag is the same as "BakeryLightmapGroupSelector" script, except it can have several generated lightmaps for the group of objects.
    Do you know if there is a trick to do that with Bakery?

    Thanks
     
  30. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    192
    just checking to make sure, is there any danger in moving the default Bakery & Editor folder? I moved the Assets\Bakery folder to Assets\Plugins and then moved the Assets\Editor folder into the Assets\Plugins\Bakery folder.

    It seems like Bakery is functioning without issue, but I noticed there are some hardcoded paths in the code (that I don't want to modify)
     
  31. yang-yu

    yang-yu

    Joined:
    Mar 8, 2013
    Posts:
    21
    @guycalledfrank the crash was cause by unity compile assemblies when import Bakery base the Editor.log, i guess shouldn't include UnityEditor stuff to monobehavior, like things you do with the scripts.
     
  32. kainoo

    kainoo

    Joined:
    Aug 24, 2015
    Posts:
    10
    Hi,
    First thank you for this amazing tool, it really does save a lot of time :)
    I am having an issue " Can't repack LOD UVs for MyLightGroup ", wich is causing my bake to stop.
    I couldn't find out what uvrRepack() does, so here I am.

    Console logs :
    Min LOD resolution for LightGroup is 256
    Can't repack LOD UVs for LightGroup ( at ftBuildGraphics.cs : 4561 )
    IndexOutOfRangeException : Array index is out of range ( at ftBuildGraphics.cs : 4668 )

    What am I doing wrong ?

    Thanks in advance,
     
    guycalledfrank likes this.
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Bakery group is 1 lightmap. There is no bakedTag substitute to group selected objects into multiple atlases (yet?). However, similar thing happens if you bake multiple scenes with "split by scene" checkbox - each will get its own set of atlases. Objects belonging to different LOD levels also currently get into separate lightmaps.

    It should be safe to move folders. I'd recommend restarting the editor after moving, just in case.

    Hmm? UnityEditor namespace is necessary for Bakery editor scripts to work. All UnityEditor references are removed from builds.
    Did you manage to get it working now?

    Seems to be a problem with GI VRAM optimization. How large is your scene? Are you sure the Texels Per Unit value is adequate? Can you enable Memory Warning (it's in the bottom of the window), click Render and check if doesn't try to use extra huge amount of memory? Maybe also take a look at Checker Preview.
     
  34. kainoo

    kainoo

    Joined:
    Aug 24, 2015
    Posts:
    10
    I had quite a few objects in my scene and after adapting lightmap scales it seems to be working.
    Since I'm targeting final result's lightning the texels per unit value is about 100.
    Thanks for the quick answer !
     
    guycalledfrank likes this.
  35. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    169
    Hey @guycalledfrank, does Bakery support 2019.1? We updated but noticed that the lightmaps in our prefabs look incorrect, anything we might have missed during the upgrade process?
     
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    2019 just came out of beta, so didn't test it yet. Next major version will guarantee compatibility.
     
  37. BATTLEKOT

    BATTLEKOT

    Joined:
    Oct 2, 2016
    Posts:
    95
    Hello! I can't understand how to fix that problem?
    I have 3 errors in one file.
    I made photoshop of all problems with problem log
    upload_2019-4-18_18-50-36.png
     
  38. Dawie3565

    Dawie3565

    Joined:
    Dec 30, 2018
    Posts:
    68

    hey battlekot this may help or not .. If bakery loads correctly you would find a new tab called "Bakery" between Tools and Windows .. if I could suggest you to clear the download from the asset store and redownload again .. In windows you could find it in appdata, type this into the file explorer: %APPDATA%\Unity\Asset Store …. then find the folder called Mr F and delete the contents , this will tell the asset store to redownload a fresh copy next time you connect...
     
  39. Kolgrima

    Kolgrima

    Joined:
    Feb 2, 2009
    Posts:
    38
    Finally had a chance to get back to this, and yes calling DynamicGI.UpdateEnvironment() fixed the issue Thank you!
     
    guycalledfrank likes this.
  40. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Please reimport the package and click "I made a backup, go ahead", when Unity asks.
     
  41. BATTLEKOT

    BATTLEKOT

    Joined:
    Oct 2, 2016
    Posts:
    95
    thank you very much!
     
    guycalledfrank likes this.
  42. sSuite

    sSuite

    Joined:
    Sep 28, 2014
    Posts:
    10
    Hey! Loving the asset so far. Is it possible to bake only ambient occlusion and nothing else? I'm working on a stylized art pipeline and I need to be able to store AO separately from other light info (eventually this'll get incorporated into the lightmap as a separate color channel).

    I was able to do this with the built-in progressive lightmapper by setting up 6 shadowless directional lights -- one pointing in every cardinal direction. A bit of a hack, but it worked! I'm hoping I can switch to Bakery, though, since the progressive lightmapper seems to be completely unstable, and I'm tired of the headache. Any ideas?

    Thanks!
     
    guycalledfrank likes this.
  43. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Anyone know how to batch bake by script? I use v1.4, and when I trigger RenderButton(), one time bake is fine, but when bake in batches, it would go on to bake next one without waiting for last one to finish.

    edit:
    I used some struct like this to excute the IEnumerator, seems fine for now, testing !

    1. if (!TestSystemSpecs()) return;
      selectedOnly = false;
      progressFunc = RenderLightmapFunc();
      while(progressFunc.MoveNext()){}
     
    Last edited: Apr 22, 2019
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,205
    Currently not. Seems like a popular request though. I can make it happen, but it would be still applied as a regular lightmap (i.e. won't work the same way Standard Shader's AO slot does).

    Oh you can do that as well. Just use 6 white Bakery Direct Lights with shadow samples = 0 and enable AO :)

    Yes rendering is done via a coroutine, so that should work.
     
    sSuite likes this.
  45. sSuite

    sSuite

    Joined:
    Sep 28, 2014
    Posts:
    10
    Aha, sweet! Didn't think of changing the shadow samples. Thanks!

    This would be handy to have, even with my stupid directional light trick. I personally would need it as a lightmap anyway.
     
    Last edited: Apr 22, 2019
    guycalledfrank likes this.
  46. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Who knows what's the maximum range of HDR lightmap color in bakery? How can I get float color buffer?
     
  47. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Actually, it's half way working, I stuck at this: upload_2019-4-22_22-52-47.png
    do you know why?

    I debuged the code and finally got to focus on a loop:

    while(uerr == 0)
    {
    uerr = GetABGErrorCode();
    Debug.Log("Render ABG Error");
    yield return null;
    }
     
    Last edited: Apr 23, 2019
  48. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,403
    Just purchased and going thru the QuickStart.

    Are the custom Bakery Shaders and Light components necessary to create a Bake with Bakery or are they only optional?
     
    Last edited: Apr 22, 2019
  49. HenriSweco

    HenriSweco

    Joined:
    Aug 8, 2016
    Posts:
    28
    Bakery shaders are not required for regular lightmaps and some things Unity shaders support, read the 'Bakery Shader' part in the doc for more information.

    Light components are necessary, and Bakery lights do much more than Unity lights.
     
    guycalledfrank likes this.
  50. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,403
    Thanks
    So in my scene I have several Area Lights (Baked) 9 Spotlights(Baked) 1 Emissive Texture light (Baked) and 3 additional Emissive Textures (Realtime).

    I will need to replace all of these with new Bakery lights from the Create menu

    I assume any mesh with an emissive texture (and NOT Realtime) will need the Bakery light Mesh component?

    Also I notice there is no Culling mask with the Bakery lights. Why is this?

    Also when using the LWRP, what additional changes are needed?

    So far no luck in making this work but will keep trying...
     
    Last edited: Apr 23, 2019
unityunity