Search Unity

Lightmaper doesn't bake or it lasts a lot of hours

Discussion in 'Global Illumination' started by bodzi0x95, Feb 13, 2019.

  1. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    12
    Hi!
    I have a pretty big problem with our project and totally got out of ideas how to deal with it.

    Before, we worked on unity 2018.1.9 f1. Lightmapping for city and rest terrain was taking around 15-20 mins what was pretty good and acceptable time. Now we updated project to 2018.3.3 and baking doesn't work.
    It get stuck on "preparing bake" or "baking", Tbh nothing changed in project since we was baking on 2018.1.9.
    No errors, no crash, it just doesn't go further.

    We have scene for light settings and light objects (this is scene where I'm baking light) and second scene for city. I'm getting warning that my scenes have different lighting settings but even if I remove all scenes and load a draft one it still doesn't bake. But it worked with this setting on 2018.1.9
    New fresh project works well.

    My light setting is mixed with baked indirect. I'm attaching my lighting window


    UPDATE/
    I changed lightmap resolution to 2, environment reflections to uncompressed and it's baking but it lasts ~16h now. It's really dissapointing comparing to 2018.1.9 where I could bake lightmap in resolution 10 in 2h.

    Anyone have an idea what we could change to make it faster, OR what have we already changed that caused this long bake time?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! If your scene is very large, and you are also baking a terrain, the obviously bakes can take a while. However, it is strange that you are experiencing this performance regression after upgrading.

    Judging from your lighting settings, it seem that you are compressing both your lightmaps and environment probes. If your target platform is mobile, these two settings can increase the bake times dramatically, as compression takes much longer.

    Also, you seem to be using 2 bounces for your environment reflections. Each additional bounce increases bake times as well.

    There are couple of ways we could figure out whether or not this is a purely lightmapping related issue. If you have many reflection probes in your scene, could you try disabling them and rebaking? If the issue disappears, then you'd most likely have to optimize your reflection probe placement and settings.

    Also, how many lightmaps does your scene contain after a bake? It would be also nice to see a Baked Lightmap view of your scene with Lightmap Resolution overlay on, in case if there are texel density problems.
     
    karlschecht likes this.
  3. HeroBlocks

    HeroBlocks

    Joined:
    Jun 17, 2017
    Posts:
    7
    Experiencing same problem here, we just updated to Unity 2019.2.3f1 from Unity 2017.4.8f1.
    Same settings, rendering took appr 20 min before, now its 8 hours+ up to never ending...
    Tried turning off everything possible, setting all to a minimum, no changes.
    [COLOR=rgba(0, 0, 0, 0.87)]
    [/COLOR]
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    This should not be happening. Have you tried the typical sanity checks, such as deleting the library folder, clearing GI cache, and reimporting the project? If this behavior still reproduces it might be a good idea to submit a bug report (preferably, with a small repro project that we could test ourselves).
     
  5. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    Same here, 2017.2.7f2, gets stuck on "Baking...". Doesn't matter what settings I apply. I'll re-import everything again, but now we're going to miss a deadline.
     
  6. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    When this happens I need to kill Unity from the task manager.
     
    brandonschlosser101 likes this.
  7. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    We have notices the same thing recently.
    Can figure out that it is enabled LODGroup component

    If all LODGroup component disabled cpu lightmapper can process mostly empty map in 20 min -> 5 mray/sec
    If all LODGroup component enabled cpu lightmapper can process mostly empty map in 7 hours -> 0.15 mray/sec

    for normal map:
    disabled LodGroups - 4hours -> 3.5 mray/sec
    enabled LodGroups - 38hours -> 0.22 mray/sec and crash after 32hours
     
  8. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Does new lightmapper is incompatible with LodGgroups or it is a bug?
     
  9. GluedPixel

    GluedPixel

    Joined:
    Nov 26, 2018
    Posts:
    11
    Hey guys, so after digging in a similar problem I found out that by changing the color space from Gamma to Linear makes a huge difference in baking time.

    Project Settings > Player > Other Settings > Rendering > Color space
     
  10. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    How big of a difference are we talking about? In which Unity version have you observed this issue?
     
  11. GluedPixel

    GluedPixel

    Joined:
    Nov 26, 2018
    Posts:
    11
    In the project I was testing the difference was from 5-6 hours to 10 minutes and the result was pretty good. But, for other project that I tested, most of the times the results were really ugly ....

    Even now, trying to generate lighting for my current project which is a basic scene would take it around 10-15 minutes but it's not worth the waiting because of the bad results.... The entire scene looks better with real time lighting.

    Unity version: 2019.2.7f2,

    Pc specs:
    Intel i7-5930K 3.50GHz
    rtx 2080S
    16 GB RAM.

    Maybe we can make a few tests with different projects and settings to see where the problem is.
     
  12. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    154
    I have also been experiencing the Progressive GPU lightmapper freezing during Preparing Baking (and my CPU/GPU don't seem to be working hard, as the OS reports they are not and their fans never kick on).

    I have noticed that it seems to possibly be related to how large and complicated your scene is, how many Texels you have the Lightmap Resolution set to and how large you set your lightmap size.

    When I left my scene size and complexity and lightmap resolution the same, but decreased the lightmap size, it managed to get past the Preparing Baking phase and into the actual calculations. My fans kicked on, but as I was writing this post, the thing crashed with these messages.

    I should note that by "crash", I mean I got these messages in the unity console log. The UI for the lightmapping process itself appeared frozen, and didn't alert me to any problems. And my fans turned down. It would be nice if the UI for the Lightmap process itself knew it's not working anymore, somehow.

    upload_2019-12-4_2-49-44.png

    I am running this on a laptop with a 6GB VRAM GTX 1060

    upload_2019-12-4_2-51-43.png
     
  13. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    64
    Just hit this issue in 2019.3.1f1. A scene that normally baked in about 10 seconds suddenly was completely stuck Preparing Bake forever (progress bar not moving at all) / had to force-quit unity via Task Manager. I deleted the Library folder and it is back to normal.
     
  14. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    64
    Imported some new models, mucked around with them and am seeing a similar issue. Stuck on Baking now, have to force-quit Unity via Task Manager. No settings changed at all, just importing models (and then deleting them).
     
    Last edited: Mar 5, 2020
  15. unity_mqGzbQYn0Z1pEw

    unity_mqGzbQYn0Z1pEw

    Joined:
    Sep 4, 2019
    Posts:
    1
    Also having this issue with 2019.2f1.
     
  16. borkbork

    borkbork

    Joined:
    Jul 5, 2014
    Posts:
    64
    Quit and re-start fixed it for me this time.
     
  17. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    281
    I am having the same issue on macOS 10.15.4 on a Mac Pro late 2013

    It will get stuck on "Preparing Bake" and it wont progress so I have to force quit Unity (if I just try closing Unity it freezes)

    I am using Baked light mode
     
  18. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Set the Params to low resolution. It makes the later steps waaaay faster, allowing you to iterate faster. Just remember to set it back when you do a final build, which should take hours.
     
  19. brandonschlosser101

    brandonschlosser101

    Joined:
    Apr 19, 2018
    Posts:
    15
    This was what solved my issue with this. Unity wasn't frozen or anything. Maybe it just got really nervous. lol
     
  20. Shawn-Halwes

    Shawn-Halwes

    Joined:
    Jul 17, 2013
    Posts:
    51
    We upgraded from 2017.4.38f1 to 2019.4.4f1. Cleared GI cache and scene's lighting data. Did a bake with progressive lightmapper and it took a reasonable amount of time with expected results. Increased the resolution from 4 to 5 and started a new bake. Bake took forever with ETA stating 500+ hours. We just killed the bake. Tried a few other times with the same results of baking taking forever.

    I gave up on this issue as it was blocking progress so I don't have anymore information. Plan to revisit it next week.

    Seems like a lot of people are reporting similar issues anyone have any idea what is causing this?
     
  21. andre_ss6

    andre_ss6

    Joined:
    Feb 22, 2017
    Posts:
    1
    I too have a scene super simple, with only a single directional light and some cubes; yet, baking predicts it's going to take several days. I'm on a Ryzen 7 2700X and GTX 1070. Tried both CPU and GPU baking; GPU is much faster, but still the bake process predicts it's going to take several hours.

    I'm using Unity 2020.1.7f1.

    Last time I used Unity was 2015, and although I know Lighting has changed a lot since then, baking used to take only a couple minutes back then on a much more complex scene (interior with sunlight coming through the windows) and on a dual core and gts 450.

    I was really surprised when I saw that the simple scene I'm testing now would take hours to bake on my computer.
     
  22. BennyKokMusic

    BennyKokMusic

    Joined:
    Dec 22, 2016
    Posts:
    33
    I'm on 2020.2.1f1, was baking fine before, then suddenly stuck at the preparing bake stage saying might need an hour, then stuck on quitting unity, next force quit and restart Unity, and it seems fine again. I'm with RTX 3060 Ti.

    Restarting really helps sometimes...
     
  23. Deleted User

    Deleted User

    Guest

    I'm seeing this issue in 2019.4.22f1
     
  24. Jihaysse

    Jihaysse

    Joined:
    Mar 29, 2020
    Posts:
    53
    Also having this issue on 2019.4.

    I actually can't bake my scene (which is rather simple - not small but not a battle royale map lol). A few trees and rocks.
    It made my iMac crash with unity taking 80+ Go. I had to force quit Unity, so I can't even bake. I have 32 Go RAM and 4 Go GPU.
     
  25. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    327
    Is this using the CPU lightmapper? And does it only happen on 2019.4, or also newer versions of Unity?
     
  26. Jihaysse

    Jihaysse

    Joined:
    Mar 29, 2020
    Posts:
    53
    Yes, I'm using the CPU lightmapper.
    I'm only using Unity 2019.4.2f1 (no more space on my iMac for a newer version of Unity and I'm sticking with LTS without upgrading my project just to be safe) so I unfortunately can't tell you about newer version.
     
  27. Deleted User

    Deleted User

    Guest

    This is also happening to me. I am using the latest LTS 2019.4 (2019.4.26f1). I am using Progressive GPU (preview). The bottom right bar will get stuck on baking and show no progress. It's definitely a bug. Using task manager to kill unity. Then relaunching will make it work correctly. Now my bar has a listed ETA and it seems to be progressing.
     
    tenconmar and michaelgatesdev like this.
  28. muzboz

    muzboz

    Joined:
    Aug 8, 2012
    Posts:
    110
    I'm trying to use Progressive GPU (Preview) with very low settings on a BLANK SCENE (no game objects of any kind), and it says "Global Illumination" down in the progress bar, with blue highlight "bouncing back and forth" forever, but never actually shows progress.

    Super frustrating.

    Unity 2020.1.1 HDRP.
     
  29. vincent-deco

    vincent-deco

    Joined:
    Jul 21, 2021
    Posts:
    3
    2021.2.0b here. I could bake once... I had to change some mat and remove some object (yes, there's less object in the scene now) and baking = 0% forever... Noone have found what the problem is?

    upload_2021-11-24_17-30-25.png

    And it uses 95% of my CPU... for nothing apparently
     
  30. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Why are you using a beta? 2021.2 has released now.

    Try making a bake with really low resolution and samples values and see if that finishes.
     
  31. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    247
    We have the same issue on multiple computers with both the GPU and CPU Lightmapper (unity 2020.3016).
    It is stuck indefinitely on Preparing bake. Quitting unity (mostly through the Task Manager since it will hold on the quitting dialog) and restarting the project, clear bake and start again mostly works. I did notice that turning off Progressive Updates will make the baking more stable.

    But this is far from the preferred workflow. First post here was from feb 2019. Whats going on?
     
  32. belgaardunity

    belgaardunity

    Unity Technologies

    Joined:
    Oct 14, 2021
    Posts:
    8
    Hi @PieterAlbers, did you (or anyone else) file a bug report with a small repro project? If so, I would be happy to check the progress of this issue.
     
  33. Excalibur_1st

    Excalibur_1st

    Joined:
    May 6, 2020
    Posts:
    8
    @belgaardunity I have the same issue! It is apparently a problem with my Unity 2021.2.8. I tried this on many scenes
     
  34. pseudocolor

    pseudocolor

    Joined:
    Dec 15, 2019
    Posts:
    4
    Using Unity 2020.1.4f1 on URP, the light baking took forever, even when it just a primitive plane and cube.
     
  35. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    Unity 2019.4.29 and the same thing. Any updates on this yet? It's just sitting there - almost no CPU consumption, RAM hasn't shot up or anything.

    Edit: Well, in my case I think it was Avast. It must have gotten installed recently with another app I installed. I uninstalled Avast a few days ago and forgot I needed to reboot for it to take effect. Noticed during baking that there was a Unity subprocess related to Avast, rebooted, and then baked fine afterwards with Avast cleanly out of the way.
     
    Last edited: Feb 8, 2022
  36. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    20

    deleted the "library folder"... huh??
     
  37. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    327
    The Library folder found in the root of a project. It gets populated when you open a project and contains stuff like imported assets and a shader cache. Deleting it can often fix borked project, but is a bit of a 'nuclear option'.
     
  38. C0lonnello

    C0lonnello

    Joined:
    Nov 7, 2022
    Posts:
    30
    Same problem here, and I already tried:
    - GPU and CPU Lightmapper
    - Super low settings and resolution
    - No probes in scene
    - Nuked Library folder, cache etc.
    - Different scenes in the same project

    Another different project of the same version had no problem baking lighting, my next steps would be create another new project with same packages etc. but it would be a lot of wasted time, with no guarantees it will work.
     
  39. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    327
    If you are still facing issues, the best advice I can really give is to file a bug report with your project attached, so we can take a look at it.
     
  40. sabirworkspace

    sabirworkspace

    Joined:
    Jul 19, 2023
    Posts:
    3
    Simple install Post processing package from unity registry it will automatically solved the problem