Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

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

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

  1. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Try downsampling the HDR cubemap to even lower resolution, e.g. 64x64. It shouldn't affect diffuse lighting much, but should help reduce fireflies.

    Are there any console errors? If Unity fails to compile any script in the project, it will prevent it from compiling everything else, including Bakery.
    Pink skybox: maybe the developer didn't properly import Bakery? Do they have Assets/Bakery/ftSkybox.shader and is it used on the skybox (in case you used Bakery skybox shader)?


    There might be a bug with GI VRAM optimization I didn't manage to track yet due to not having any scenes where it can be reproduced :(
    Not exactly sure, but maybe reducing Max Resolution (to e.g. 2048 or 1024) will help.
     
  2. Foxdeimos

    Foxdeimos

    Joined:
    Sep 17, 2015
    Posts:
    5
    Alright, the skybox issue is most probably due to the shader, since I am indeed using it and I believe I haven't uploaded the Bakery shaders, so that should be one mystery solved. Still, according to my co-worker, there were no actual errors when he tried opening the scenes. He did receive this warning message:

    "Lighting data asset ‘EPI Scene_0_probes’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt."

    Which I have seen numerous times before, being this a message that I'd only get after baking light probes in a scene before baking in reflection probe data. I did find this odd, since I did add reflection probes to all scenes, and these warning messages no longer appear in my instance of the project here.
     
  3. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    12
    Hey! Fantastic plugin, I am having some issues with a few of my scenes however. I hope you can shed some light on the problem (get it?). Anyway, I've baked the scene using a mixture of your lights in Distance Shadowmasking with Dominant Direction mode. My results look fantastic when in play mode but in the editor it is all white boxed and I see some strange issues on some of my none shadow mapped textures.
     

    Attached Files:

    guycalledfrank likes this.
  4. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    12
    Quick response, I just noticed that checking the "Show Checker" preview and then unchecking it resolves this problem. Maybe I missed something.
     
    guycalledfrank likes this.
  5. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Did you upload both folders Bakery uses? Namely:

    Assets/Editor/x64/Bakery
    Assets/Bakery


    It's split into two parts, because one is for editor only and another can be used in builds. You need both.


    This one is harmless.

    Huh so it seems like you were stuck in checker mode (??) but perhaps with checker pattern itself being too large to notice. There is definitely a problem with non-lightmapped objects in checker mode still using random lightmaps from surrounding objects, and the door looks similar. Perhaps you enabled checker preview and then closed the scene/switched to another or something similar? I'm gonna test this a bit.
     
    Foxdeimos likes this.
  6. Quinix

    Quinix

    Joined:
    Nov 22, 2017
    Posts:
    1
    I love the program but I keep getting this error here and there with some projects I am working on. It gets stuck in "Adjusting sample points for (mesh group name here)..." (in this case it was LMGroup_Meshes) The progress ranges from 0 to 3% aka it tries to progress the bar until the error pops up. The popup window then gets stuck. You can press Cancel but when you do the window reopens instantly. Got plenty of storage on my volumes too. I also tried reimporting bakery all together. The error code here below:


    Win32Exception: ApplicationName='C:\Unity\Nixie's Authumn\Assets\Editor\x64/Bakery/ftrace.exe', CommandLine='fixpos12 "C:\Users\xxxxx\AppData\Local\Temp\frender" "uvpos_LMGroup_Meshes.lz4" 2 0 1', CurrentDirectory='C:\Unity\Nixie's Authumn\Assets\Editor\x64/Bakery'
    System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process)
    System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process)
    System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
    ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3804)
    ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:127)


    PS: Some more info:
    - I am using Unity 2017.4.15f1 and am stuck with this version due to the game im making this for.
    - Default experimental settings are used. Texels is set to 30 and samples is set to 64.
    - It worked before until I rebooted my PC and started the project up again a week later.
     
    Last edited: Dec 12, 2018
  7. Foxdeimos

    Foxdeimos

    Joined:
    Sep 17, 2015
    Posts:
    5
    While I was waiting for an answer, I conducted some tests here myself and I decided to just upload the rest of the shader and script files for the asset and cloned a new fresh copy of the repository on my local machine to test, and things seem to be working as intended. The only thing I fumbled a bit with, which I really did not find any mentions on the documentation but I did find a post here on the forum about, is regarding the ftLocalStorage.asset file which, as you stated, should not be uploaded into version control. You only mention a small blurb about the ftGlobalStorage.asset file for older version of Unity and/or Bakery (Which isn't my case), so when I opened the full project finished importing, some of my maps looked completely wrong. After removing ftLocalStorage.asset from our version control and adding it to .gitignore, then re-importing the affected models, everything seems to be working fine now. Still, I believe it would be helpful to do a quick update on the documentation so people know what they should and shouldn't be including on Version Control. In any case, I sincerely appreciate the help, and once again, thanks for the absolutely fantastic asset!
     
    Mark_01 and guycalledfrank like this.
  8. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Ah yes, every month there is at least one person who gets into this infamous bug. The problem is in the file path, it doesn't like the apostrophe (the " ' "). I'm gonna fix it ASAP.


    Ouch. True. Added to the docs!
     
    Quinix, Mark_01 and Foxdeimos like this.
  9. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    12
    I'm afraid I can't tell you exactly what I had done. I literally just started playing with the tool (without reading the docs, because let's be honest, most people do). Then I read the docs, recreated a project and everything was fine and I did something, then it happened again (I'm afraid I wasn't paying attention to exactly what I did). However, it was easily fixed by enabling and disabling the checkbox. Though I have to say, it was useful to see the scene as white boxes with only the shadow map displayed on top.

    I'm afraid lighting is really not my strong point and I now have a new issue, it could be that this isn't possible but I'm hoping I'm just doing it wrong.

    I have a scene where I am looking to bake Spotlights. Even when set to Baked mode, disable the Unity light, Linear lighting mode, full lighting, no directional mode, no real-time lights. Only the directional lighting seems to get baked and the spotlights appear to get ignored.

    I am obviously missing something, any clue?

    Thanks for your help, here's my set up;
     

    Attached Files:

  10. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    hey @guycalledfrank, me again (yeah, i know...) I came across something i can't really figure out and i don't know what i could have missed. (Note that i didn't have this issue with enlighten)

    You once told me wisely that
    "Bakery supports cutout transparency, but currently doesn't support semi-transparent surfaces."

    And indeed, it does support cutout transparency when i tested right after you said it

    (one-sided unity Quad in a simple scene)

    At this point, nothing's wrong. But here in my project, doing the same thing (well at least i believe) get me to this

    Ok i know the tree isn't a beauty but give it a chance OK?! All i can say is that it's a simple one-sided Unity Quad with the same parameters than the first pic.



    Am i missing something ?

    With much love,
    xoxo

    PS: Weird thing is that when i copy/paste the gameobjects that cause the issue in a new blank scene, i don't have any problem. might be bad luck ?

    PS2: The tree part looks like it's juste a unity bug that doesn't read my psd correctly (it pixelates it a lot whereas it's a HD map). Just saving it with an other name get rid of the issue (the pixel part and the shadow part). Weird thing huh?

    Still got nothing for the other case.. loke like to work fine in the blank scene.

    PS3: Just noticed that semi-transparent materials actually work too in these blank scenes (fade and transparent). I don't get it.. I have exactly the same bakery parameters in my scenes. Looking further..
     
    Last edited: Dec 13, 2018
    guycalledfrank likes this.
  11. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    260
    Just a random nitpick request, could you make the links on the AssetStore description actual clickable links? so people don't have to copy/paste them :D

    upload_2018-12-13_9-37-47.png
     
  12. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Settings look good. Make sure the lights are not inside of some object or slightly above the ceiling (it's often OK for real-time lights as they don't have accurate shadowing, but won't work for raytraced shadows).

    Really weird indeed. So all of your alphas work in a separate scene but always (?) look opaque in this one?
    If so... can you try baking the main (bugged) scene and then sending me these files from Bakery's temp folder:
    alphabuffer.bin
    alphaid2.bin
    ib32.bin
    vbtrace.bin
    vbtraceUV0.bin
    These should be enough to check if the maps are packed and mapped correctly, and if not, I might have a clue how to fix it.

    They do, but they are treated as cutout.

    Definitely. I kinda didn't realize it's possible :D
     
    Yuvii and Mark_01 like this.
  13. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    12
    Hey Frank, thanks for the reply. Yes, I checked this before the previous images - I've attached a screenshot in case this is still too close.

    Additionally I've started to receive a new error after every bake which causes the progress Dialog to stick at 100% and requires be to close and reopen Unity for the maps to apply.

    Code (CSharp):
    1. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2. Parameter name: index
    3. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    5. System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    6. ftRenderLightmap+<RenderLightmapFunc>d__176.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:4313)
    7. ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    8. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:200)
     

    Attached Files:

  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Seems fine (the screenshot doesn't look like there are any lightmaps, by the way).
    Also check if increasing distance/range of the light makes any difference.

    Error: I believe I fixed it recently. Just sent you a patch in PM.
     
  15. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    12
    Yes, the lightmaps had been removed for the screenshot. I've tried various ranges, in real-time it's fine. I'll play with some extreme range. Atm I'm 20m distance with 1.4 intensity on a 15m(ish) high spotlight.

    Excellent, I'll have a look.

    Cheers
     
  16. jjerald

    jjerald

    Joined:
    Jan 27, 2013
    Posts:
    2
    I get the following error:
    Error (-1): Unknown error (Details: Function "_rtContextLaunch2D" caught exception: Encountered a CUDA error: cudaDriver().CuEventSynchronize( m_event ) returned (702): Launch timeout)

    The problem does not occur when I set texel size to 0.1 but does consistently occur when I set texel size to 1.0 (and it occurs for various settings changes I tested). I need to get my texel size up to 7.7 to match what I was previously getting with Unity lightbaking.

    I'm using Unity 2018.1.6, an Intel i7-8700K CPU, and a NVidia 1080.

    What does this error mean and how can I fix it or work around it?

    Thanks,

    Jason
     
    Last edited: Dec 14, 2018
  17. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    463
    Hey Frank, you know what Bakery REALLY needs right now?
    A button to save and load config presets!

    If I click on "clear baked data", the bakery config gets erased too and I have to reconfig everything manually. I ended up taking a screenshot of the bakery windows! :rolleyes:
     
    Last edited: Dec 14, 2018
  18. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Looks like, yes. Actually it's in more than one project, and happens in the main scene. These scenes are pretty heavy (not that much tho but still), might have something to do with the issue (?) I'm still testing what i can test, i'll send you the files you asked

    Agreed, can be useful to save some time
     
    Last edited: Dec 14, 2018
    guycalledfrank likes this.
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Weird. I have a slower GPU but I never got that error. Might be something about drivers/Windows settings. Anyway, the reasons are simple: https://devtalk.nvidia.com/default/topic/654001/optix/optix-error-kernel-launch-returned/
    There are at least 3 possible solutions:
    - Update drivers?
    - "Do less work more often" - you can make Bakery do that by decreasing GPU Priority (aka Tile Size).
    - "Increase the TDR timeout". That should work without any changes to Bakery settings. https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys
    Try setting HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers\TdrLevel to 0 and see if it helps (you can create TdrLevel entry if it doesn't exist in GraphicsDrivers).
    In general, that should never happen though. I'm curious why it did. Does the same thing occur on built-in example scenes too?

    I know! It was requested multiple times, and it's definitely on my list :)
     
    Mark_01 and atomicjoe like this.
  20. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Can't find these files, where can i get them ?


    I noticed that the while the trees got the issue, the parking spots which are cutout static too donc have any shadow, and it looks like they dont receive shadows either (look left)



    got these errors, they might be related to the issue ?
     
  21. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    102
    Hi, no much idea about bake light, so it's my first try.
    I have a big open world and I use Enviro so I guess I can't bake the hole thing, but I'm baking levels where the quests take place and I need better performance.
    I have baked a level with around 30 lights and when I run this level on a new / empty scene works fine, but when I add it to my main scene I get around 45 mill triangles and 65k batches (around 8 times more) when the lights are on.
    I have linear color and deferred rendering on my scene. If I switch quality to fast then I don't nave this issue as there are not shadows, and there are therefore almost no differences on drawcalls when lights are on / off.
    I'm using point lights and I have tried mixed and only baked but I have the same issue.
    Any ideas? Thanks.
     
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    In Bakery's temp folder. You can set it in Advanced settings. By default the path is C:/Users/You/AppData/Local/Temp/frender

    Are they static? Do they have any lightmap assigned?

    They shouldn't be. I'm not sure why it happens, but it doesn't seem to break anything.

    The normal real-time Unity lights? You should disable them, if the lighting is baked. Did you read the manual, btw?
     
  23. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    That's what i thought aswell but the folder seems to be empty


    Yes, and yes it looks like


    Yeah nothing seems broken except these shadows.
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    That's impossible if:
    - "Temp path" is set to the same folder in Bakery.
    - You didn't clear it manually.
    - You checked the folder right after bake.

    Perhaps they're very low resolution?
     
  25. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Well....
    I clicked on the Temp Path: button in bakery window so it's in the same folder

    I cleared nothing manually
    I checked right after the bake

    Doing it again just to be sure, i'll let you know.

    I don't think so, as i said it works fine in a clear scene, with the same texels/unit parameters and the shadow itself doesn't look low resolution. The whole lightmap is in a good resolution tho

    I'm out of idea, i'm trying to rebake to see these .bin files

    EDIT:
    @guycalledfrank Still nothing after rebake. Folder's empty.
    (still got the same warning + error)

    EDIT2:
    Ok, the Temp Path: button is just to change the temp folder and doesn't actually show what's in the folder... my bad :rolleyes: I'm sending you the files.
     
    Last edited: Dec 14, 2018
    guycalledfrank likes this.
  26. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    102

    "when the lights are on.
    The normal real-time Unity lights? You should disable them, if the lighting is baked. Did you read the manual, btw?"

    Ok, I think I know what happens, I thought the baking was ok but I don't have any lightmaps, and watching the console I get this error in all the meshes on the scene:

    Mesh Mast_fence01 on object Mast_fence01 has incorrect UVs (True, 1,12623, 0,3448085)

    UnityEngine.Debug:LogError(Object)
    <ExportScene>d__124:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:1642)
    <RenderLightmapFunc>d__176:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2886)
    ftRenderLightmap:RenderLightmapUpdate() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    How can I fix it? Thanks

     
  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Did you generate lightmapping UVs for the mesh? You can either do it in advance when modeling, or use the "generate" checkbox on the model asset.
     
  28. jjerald

    jjerald

    Joined:
    Jan 27, 2013
    Posts:
    2
    Yes we generate lightmapping UVs in the Unity import settings for each object. Unfortunately we don't have the original models and there are hundreds of them so it would be difficult to manually create those UVs.

    I turned off different groups of models and still had crashes so I don't believe the crash is specific to a single model. It might be a problem with multiple models though. Is there a way to get debug information informing me of what object is causing the crash or what is the most recent object being processed before the crash? I couldn't find anything obvious in the Editor logs or trace log.

    Thanks,

    Jason
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    I think you're reading the wrong post. I answered you question in post #1769.
     
  30. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    102
    Did you generate lightmapping UVs for the mesh? You can either do it in advance when modeling, or use the "generate" checkbox on the model asset.

    okkk,
    I did on every mesh and now I get the lightmaps baked for the direct light (1) but none for the point lights (30). Is the same prefab (light) that I'm using on your demo scenes for testing and there works fine. Any ideas why this may not be working? Thanks

    PS: I keep having the same error: Mesh___ has incorrect UVs (True, 10,125, 0,1382485)
    I already generated the UVs editing the mesh and the direct light works but the point lights don't generate the lightmaps
     
    Last edited: Dec 14, 2018
  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Can you show screenshots of:
    - Main Bakery window
    - All components on your point lights
    - The result
    ?
     
  32. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    102
    ok, finally ended up that my lights are a prefabs inside of a mesh with a transparent material that works fine in real light but apparently doesn't work on Bakery light so the light didn't leave the mesh as it was inside of this. I moved the point light up so its not inside and now works fine.
    I would appreciate any workaround so I can use the previous setup (light inside the lamp)
     
    guycalledfrank likes this.
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Just disable shadowcasting for the lamp :)
     
  34. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    463
    Then it will not cast shadows of other lights too.
    If it's a small mesh, this shouldn't be a problem. But for large meshes, this will be very noticeable.
    Do you plan supporting transparency / translucency?
     
  35. unity_h8L8gU9jabHGyQ

    unity_h8L8gU9jabHGyQ

    Joined:
    Oct 24, 2018
    Posts:
    1
    Thanks--the TDRLevel was already set to 0 but I increased some of the other GraphicsDrivers registry values and that seemed to stop the crashing! FYI I also discovered that the registry edits were not required when setting minimum resolution to 16x16 instead of the higher resolutions I need.

    I'm now having problems forcing the textures to be 4096x4096. Even when I set the minimum resolution to 4096x4096 I still get a lot of lightmaps (42) where most of those lightmaps are empty/black space. Our main bottleneck is set pass calls so many lightmaps results in not meeting our frame rate requirements (Playstation VR has hard requirements).

    How can I bake with larger light textures?

    Thanks,

    Jason
     
    guycalledfrank likes this.
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    I definitely do.

    Do you use many LODs? As of now, different LOD levels can't share the same atlas.
     
  37. ArtR

    ArtR

    Joined:
    Sep 27, 2011
    Posts:
    47
    Is Bakery working in 2018.3 HDRP?
     
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Last tested version is 2018.2.2, so I'm not sure. I'm gonna test it thoroughly for the next release though.
     
  39. ArtR

    ArtR

    Joined:
    Sep 27, 2011
    Posts:
    47
    Sorry, just checked. Everything working beautifully as usual. Any known issues? Oh just saw your reply. Thanks I will keep checking but so far seems great!
     
    guycalledfrank likes this.
  40. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    The HDRP Bakery shader is known to be broken after recent HDRP updates - I'm gonna fix that, and it doesn't affect any other shaders and classic baking modes (color/direction/shadowmask).
     
    ArtR likes this.
  41. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Unfortunately, this came back to haunt me again.:( It was pretty fine lately and had done like 10 bakes successfully but then my last 3 bakes have returned black lightmaps even when the changes done to some scenes were minimum compared to a successful bake.

    I'd love to send a scene where the error is reproduced but the factors that produce the bug seem to be pretty ambiguous. The problem is also that doing a test is slow since the settings where this does happen are the ones used for final rendering and they can be 1-2 hours long.

    I think it starts to happen when the scene surpasses a certain complexity vs texelperunit ratio? Right now my GI Vram is Auto (it was Force On before), I'm going to try with Force Off but I'll probably run out of memory. Then I guess I'll try to substract 1 texel per unit until it doesn't happen. (using only 10 right now for final bakes)
     
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Maybe... remind me, do you use any terrains? I'm doing a rather radical optimization for terrain rendering right now, so that could help reduce scene complexity. Rendering them as full resolution triangle meshes seems to require way too much memory and it's also slow.
     
  43. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Not using terrains unfortunately, they are complete-indoor scenes with no skybox or directional lighting, just area lights.

    Edit: Also probably nothing to do with it but I've realized, in the same bake, I sometimes get a 'duplicate' lightmap (just in number, not content), one named LM10 and another named LMA10.
    32.PNG
    Edit2: Actually, sometimes it's not the same number but a completely different number not in linear progression like if there are only 16 lightmaps, I get as the last: 2_HUB_LM171_final or 2_HUB_LM12872_final. Just trying to discard stuff.
     
    Last edited: Dec 19, 2018
  44. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    119
    @guycalledfrank How do I set up bakery to account for a moving sun? Currently when the sun moves, it looks like there are two suns reflecting off my things.

    Edit: Ignore the two suns thing. That was just silly me having two directional lights. My bad. I am curious if there is something special I should do to allow for different times of day though.
     
    Last edited: Dec 19, 2018
  45. RobWu

    RobWu

    Joined:
    Jan 16, 2018
    Posts:
    65
    Hi,
    I'm doing a small archviz test atm with Bakery, and really liking the speed and results, but I'm getting the blue/pink coloring again. I have to reset the Skybox in the Bakery menu often, but it keeps coming back, even on a gameplay test or reloading the scene.

    I have no idea what's triggering it, as the scene hasn't really changed much. All shaders are Unity standard, and the Skylight has a basic HDRI attached to it.

    Any ideas, as this thread does mentions it sometimes, but I haven't found a real solution yet.
    Unity 2018.2.17f1 and Bakery 1.45

    thanks!
    rob
     
    guycalledfrank likes this.
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    That's... weird. Only the first one should be "LM", everything else is "LMA". I'm not sure how you managed to get LM10.
    How complex is the scene? Even if you have 16 4096x4096 lightmaps, that should be manageable. Lots of vertices?
    Also, reducing max resolution (to e.g. 2048) may help. It will generate more lightmaps, but there is less chance of hitting GPU resource limits.

    There is no out-of-the-box multi-lightmap functionality at the moment, although it's planned. You can, however, bake 2 sets of lightmaps and switch them with a script. I think I even had a detailed explanation written somewhere. I can dig it up if you're interested.

    It's on my list to investigate, but I haven't found the reason yet. It's definitely related to the default skybox probe (the one used when there are no lightprobes around) not being generated by Unity when needed. What I know though is that calling DynamicGI.UpdateEnvironment() at any time fixes it, but the results are not saved permanently.
     
    Mark_01 likes this.
  47. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Scene is a bit heavy in static objects count (like 5-7k?) but most of them are either low poly planes, boxes and a small number of cylinders. It's a modular setup and I've used Mesh Baker in order to get a reasonable 'not-too-big/not-too-small' mesh size. The scene doesn't probably go over 2 millions vertices and that's counting dynamic stuff like characters etc.

    I am already using 2048 resolution maps (both for min and max resolutions), I normally get like 16-20 maps.. In my last test, I reduced texels per unit from 10 to 9 and it baked, weird. I'm going to try a test with 4k maps and check if that weird number stuff keeps happening.
     
  48. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    102
    I'm interested on this also:

    I am curious if there is something special I should do to allow for different times of day though
    There is no out-of-the-box multi-lightmap functionality at the moment, although it's planned. You can, however, bake 2 sets of lightmaps and switch them with a script. I think I even had a detailed explanation written somewhere. I can dig it up if you're interested.

    As I use Enviro light (automatic day / night cycle) and I may need some fake day / night bakery light and some way to activate them by script
     
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,100
    Vert count looks good. Perhaps Mesh Baker does something odd to meshes? Have you tried baking the same scene without it? Object count doesn't matter to Bakery (it does for real-time render though).

    Alright, so you should be able to achieve switchable time of day via scripting by simply replacing entries in the global LightmapSettings.lightmaps array.

    Basically how I would do it with the current version (this is untested though):
    - Set Output Path in advanced settings to some new folder (e.g. "LightmapsDay").
    - Bake lighting 1.
    - Change lighting.
    - Set Output Path to another folder (e.g. "LightmapsNight").
    - Bake lighting 2.
    - [repeat if needed]
    - Create a script with multiple arrays of Texture2D, one array per time of day, put it in the scene (e.g. "public Texture2D[] lightmapsDay, lightmapsNight").
    - Put lightmaps into arrays.
    - When the game starts, let the script create LightmapData arrays from all Texture2D arrays

    ...
    lightmapDataDay[i] = new LightmapData();
    lightmapDataDay[i].lightmapColor = lightmapsDay;
    ...

    - When your need to switch lighting, just put one of your own LightmapData arrays into LightmapSettings.lightmaps.

    That should work for regular color lightmaps. For directional lightmaps it's the same, except you also need additional custom arrays for directional textures. For RNM/SH lightmaps it's a bit trickier, as they're applied via MaterialPropertyBlock (code can be seen in ftLightmaps.cs).
     
  50. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Yeah, I tried without mesh baker, actually back in the day I sent you a sample scene with 'unmerged' meshes, something related to Bakery not recognizing child objects inside a prefab that had custom UVs or something (was patched). The results were the same, if the scene was too much populated and final bake settings were used, there was a good chance for the black lightmaps to appear.

    In other news, I rendered with final settings (the ones that seems to produce black lightmaps) but this is the first time I change resolution to 4k and it came fine, whether that fixed it or simply the memory fail (if that's the issue) didn't trigger this time, I don't know. Got 192 mbs in 6 lightmaps, this time I didn't get a duplicate but the first map gets a random number: LM71 this time.
    Lightmaps.PNG
     
    Last edited: Dec 19, 2018
    guycalledfrank likes this.