Search Unity

GI stuck on Bake Indirect

Discussion in 'Global Illumination' started by theSoenke, Mar 26, 2015.

  1. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    When i try to build the lightmaps in one scene it always get stuck at 12/15 Bake Indirect with 8-10 jobs left. I've waited hours and nothing happend. And it's not a very big scene. I tried to set GI to Default-VeryLowResolution and tested it on different pcs and it was always got stuck on Bake Indirect. And when i close unity while still stuck on Bake Indirect unity crashes.
     
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi! Can you please post a screenshot of your Lighting window and your scene showing in the Editor scene view mode called Baked?
     
  3. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    Here are my lightning settings and the scene in baked view mode

    img.png img2.png
     
  4. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Does it finish baking if you lower the Realtime GI resolution?

    BTW. Your default parameters are still at Default, not Default-VeryLowResolution.
     
  5. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    I had the default parameters to Default-VeryLowResolution, but there was no effect and so i switched back.
    When i lower the Realtime GI resolution the number of jobs left on Bake Indirect decrease, but it is still does not finish Bake Indirect.

    The only way i was able to create the lightmaps was to set Baked Resolution to <= 1.2.
     
  6. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    The resolution in your scene looks very high, it would be good to start by setting the Default-VeryLowResolution as the default parameter in the scene tab. Then lower the Precomputed Realtime GI and Baked GI Resolution all the way down, and work up from there.
     
  7. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    In similar scenes it takes a few minutes to bake the lightmaps, but in this one particular scene i can wait hours and it's still not done. Only when i set the Precomputed Realtime GI or GI Resolution extremly low baking will finish. There is a certain threshold and when i set the value to something just a very little bit bigger than that it will not bake the lightmaps.

    For example here are my current lightning settings:


    With this settings it takes less than 2 minutes to bake. But when i increase the Precomputed Realtime GI to 0.2 after more than 2 hours it is still at 12/15 Bake Indirect. It even works when i set Precomputed Realtime GI to 0.199, but not with 0.2. This seems weird to me
     
  8. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    That does sound super weird! Please file a bug report with you project, so we can investigate. Thanks!
     
  9. theSoenke

    theSoenke

    Joined:
    Dec 4, 2012
    Posts:
    106
    Case number is 685394
     
  10. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,813
    just curious, but what are the largest scales of your game objects? I am having the same issue as you if the scale of one of my game objects is over 10x10x10. Reducing the scales to lower than 10x10x10 caused my bake to pass, otherwise it got hung up at one of the steps.
     
  11. WhendricSo

    WhendricSo

    Joined:
    Jan 1, 2011
    Posts:
    171
    I am having a similar issue, but mine hangs even in a tiny scene with just 3 objects and one directional light. It was working fine earlier in beta
     
    ArachnidAnimal likes this.
  12. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    The issue of baking getting stuck on "Bake Indirect" has been found and fixed. The fix will be introduced in 5.2b4. Thanks for your reproducers & patience.

    Cheers,
    Jesper
     
    ksam2 and SnakeTheRipper like this.
  13. E2R_Ben

    E2R_Ben

    Joined:
    Oct 30, 2009
    Posts:
    143
    did anyone find a good work around in the mean time? Gotta bake some lightmaps!
     
  14. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,813
    Yeah the solution is to break your scene into 5 sections and lightbake 1 section at a time. This gradually fills the cache. Then see which section(s) fail. I broke the scene into multiple bake tags, so the entire scene is not on one lightmap.I would love to know who are the people that are able to lightbake their entire scene at one time successfully.
     
  15. essimoon2

    essimoon2

    Joined:
    Nov 13, 2013
    Posts:
    195
    Hey, cool! :D Is there an ETA for this release?
     
  16. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    No ETA yet, but we are getting closer.
     
  17. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Same issue here! I'm stuck
    Please do it faster
     
    Last edited: Jul 26, 2015
  18. malviyanpawan

    malviyanpawan

    Joined:
    Oct 24, 2013
    Posts:
    7
    Hi,
    I am also facing the same issue. My half scene is baked, now if i try to bake any single object in my scene (project), it always stuck at 12/15 Bake Indirect at 1 jobs. Currently I'm using the unity 5.0.0f4. How much time I have to wait for 5.2b4. Until then what can I do to resolve this issue. My project is already delayed because of baking issue.
     
  19. saurabh.maheshwari

    saurabh.maheshwari

    Joined:
    Oct 14, 2015
    Posts:
    1
    Hi Jesper,

    Thanks for the information. Please suggest me another way to overcome with this issue as this has become bottle neck for my project.

    Can't you guys just come up with a service pack to resolve this problem for Unity 5.0.

    Many thanks in advance.
     
  20. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  21. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I have same issue with Unity 5.3.0f again!!!!!!!!
     
  22. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    29
    Same issue on 5.3.0f4 again!
     
  23. Deleted User

    Deleted User

    Guest

    Yep...unusable for my large mobile scenes...going to spend 40+ hours to bake all light in maya..I have no choice..my baked scene in 4.6 will not work..after 3 months...no resolution....

    Got a new 2K$ computer...same behavior. 5.3 stuck..using 100% CPU....I will not pay for software that I can not use in production....Fix it, I will renew my subscription...

    P
     
  24. ruj

    ruj

    Joined:
    Feb 28, 2013
    Posts:
    113
    Just saying that my scene that baked fine in 5.2 is also stalling on baking indirect in 5.3, stuck for 24 hours at 100% CPU.
     
  25. Deleted User

    Deleted User

    Guest

    Imagine, your new sportscar, in the garage, the engine red lining the RPM's overnight....yikes!

    ie..engine is cpu, rpms is cpu percentage...red line is the max line on the guage...get it?
     
    Last edited by a moderator: Dec 10, 2015
  26. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,725
    ....What?
     
    devotid likes this.
  27. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,813
    I get what you're saying. The issue is that during the bake, the UnityJobProcess.exe terminates and Unity/Enlighten starts a new "UnityJobProcess.exe". This could happen hundreds of times during the bake. If Unity could figure out a way to re-use the same UnityJobProcess.exe for the whole bake, we could go to the Task Manager and set the process priority so we could control the amount of CPU usage. But this is not really possible when current process keeps getting "killed" and new process starts. I also don't feel comfortable having 98% CPU usage constantly overnight. You have to pray that the CPU fans can keep the CPU cool.
     
    Deleted User likes this.
  28. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    I know its not a permanent solution but i use this little tool to get the UnityJobProcess under control.
    It lets you save the priority for the process even if its closes and restarts. For that it will have a little service in the background that keep the priority the same.
    http://www.askvg.com/how-to-permanently-set-process-priority-in-windows-task-manager/
     
    ArachnidAnimal likes this.
  29. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Did you have a look at the resolution and chart layout that your scene uses? This post covers how to set up a scene for fast baking http://blogs.unity3d.com/2015/11/05/awesome-realtime-gi-on-desktops-and-consoles/ the same tricks that makes realtime GI precompute faster will speed up baked GI.
     
  30. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,813
    Thanks for this link. I was going to look for something like this eventually. This could be useful for increasing the priority and/or lowering it. .
     
  31. ruj

    ruj

    Joined:
    Feb 28, 2013
    Posts:
    113
    @KEngelstoft I don't see any "chart" for my objects when I look in the lighting panel. The charts are blank, does realtime GI need to be turned on or something to see them? I am attempting to use ONLY Baked GI, which seems to be really neglected (realtime lights that double apply, etc). Also, there seems to be no way to independently set Indirect resolution per object, just a global indirect resolution setting. I want to preserve my shadow quality but tune the indirect, is that even possible?
     
  32. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,813
    I reported this as a "bug" on December 2, have not got a response back yet.
    http://forum.unity3d.com/threads/li...preview-window-after-restarting-unity.363110/
    Is this the same issue you are having?
     
  33. ruj

    ruj

    Joined:
    Feb 28, 2013
    Posts:
    113
    Hmm, no, not exactly, I DO see information in the Baked Intensity tab, just nothing in the "charting" tab. I don;t know if that is because I have realtime GI turned off.
     
  34. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    The visualizations are currently only showing when the GI bake is in progress or if you have realtime GI enabled. This is not optimal and we hope to fix this.
    You can adjust GI per object by assigning a new Lightmap Parameters to it. Do this in the Object tab of the Lighting window.
     
  35. bzAdam

    bzAdam

    Joined:
    Aug 4, 2015
    Posts:
    39
    Hi, i too am stuck on Bake Indirect. It has been going for 45 hours... Two UnityProcess.exes going both at 100%. I am using "Default-LowResolution" and a Baked Resolution of 30 (This number seems to have no effect, it never completes.) Baked GI only (no RealtimeGI).

    Scene is fairly large but made of low poly object. 11k Tris. 90% static. 2 Directional Lights, 8 spotlights.

    I am using Unity 5.3.1f and my PC is an I7 with 16GB ram.

    Did the fix mentioned about for Unity 5.2 get integrated into 5.3?

    Thanks.
     
  36. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    People are reporting getting stuck at 12/16 Bake Indirect in all versions of 5.3, up until the latest 5.3.3f1.
    http://answers.unity3d.com/questions/1076076/lightmapping-stuck-at-1216-bake-indirect-1-jobs.html?page=2
    http://answers.unity3d.com/questions/952141/gi-stuck-on-bake-indirect.html

    The Unity log file (C:\Users\YOUR NAME\AppData\Local\Unity\Editor\Editor.log) only seems to report when a job group has completed. Says nothing about what it is starting and what's going on before it hangs.

    Furthermore, your documentation page for enlignten just states the names of each baking stage and nothing about what they do.
    I have no idea how am I supposed to report or debug these problems, and to a large extent even what bake settings to use.

    Here's my log after the precompute (light transport stage):
    Now it's stuck at 12/16 Bake Indirect | 1 jobs (I also left it on this job all night last night and nothing)

    My Precomputed Realtime GI is off, my Indirect Resolution is 1, direct res is 40. My mesh size in lightmap is small enough to not give any warnings in the individual mesh lightmap inspector. My Default Parameters are Default-LowResolution (which halves all resolutions).

    I have about 320 lights (point, spot, and 1 directional) in a 120x120x50 meter scene. It takes 22 hours to bake on an i7-2700K. If I try on an arbitrary subset of 32 lights, it works in 10 minutes. I can't brute force debug all combinations though.

    PS: Y'know what else would be nice? Having the option to see a timestamp in your log file.
     
    Last edited: Mar 4, 2016
    Kikoman90 likes this.
  37. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Have you tried decreasing the indirect resolution?

    You can report the problem, using the bug reporter that is built into Unity. http://answers.unity3d.com/questions/9292/how-do-i-report-a-bug-in-unity.html
     
  38. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Yes, it did get integrated into 5.3. What is your indirect resolution?
     
  39. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    I thought the forum consensus was to keep decreasing your resolutions in order to avoid crashing or freezing. So I did try 0.1 to 2.

    Now I increased my baked Indirect Resolution to 4. My Default Parameters are still the same: default low res.
    Left it on all night, and now I got stuck at 5/11 Clustering | 1 job (but it seems 0 clustering jobs worked).
    I found 999+ of this in my log:
    Everything is failing and I a blind to why. I am a teensy bit ticked. Is there a technical paper on how Unity's Enlighten works? I just can't fathom why you'd keep running into "this is too high / this is too big" issues. No other baking tech ever runs into this problem afaik.

    - So Bake Indirect will fail (on the last job? with no other log file errors?) if indirect resolution is too big. Though I'm sure this is linked to the Scale in Lightmap and / or Min Chart Size for every mesh.
    - Clustering will fail first if the Indirect Resolution is even larger than what is required for Bake Indirect to fail.
    - I've also had Light Transport fail on me. Is that linked to Baked Resolution size? I've seen people bake small-ish scenes with Baked res of like 120 and a huge scale in lightmap and succeeded. I wonder what the sweetspot is per surface area.


    [UPDATE]: I made every mesh's "Scale in Lightmap: 0.01", and "Min Chart Size: 2 (Minimum)". And now I'm not getting clustering errors (so far).

    I have also started a separate machine with the settings above but also an indirect resolution of 0.05.

    But these will give unacceptable quality.

    [UPDATE 2]: All failed. Stuck on last job of Bake Indirect. Now trying an Indirect Resolution of 0.001.



    [UPDATE 3]: SUCCESS (as in, no stalling or crashing, it finished). Setting Indirect Resolution to 0.001 ( a whopping 4000 times less than the default value).

    I noticed that throughout the bake process, my Jobs were using much less ram, ~600MB instead of 6GB. Which makes me think I am now not using as many resources and getting as high a quality as I should. (I have 16GB ram and ssd)

    Most things have a "Scale in Lightmap: 0.01", also some things "Min Chart Size: 2 (Minimum)" (flat things, or staircase-like things with 90 degree angles).

    Here are the other settings I used (which were also chosen to get rid of some shading artifacts). Maybe it'll help some of the other poor souls tormented by Enlighten:

    Now I just have to keep upping the quality as much as I can.
     
    Last edited: Mar 7, 2016
  40. StealthStudiosInc

    StealthStudiosInc

    Joined:
    Oct 22, 2014
    Posts:
    5
    With the latest patch of 5.3.3p2, this issue still persists (even though in the notes it appears to have been addressed). Unity gets stuck indefinitely at "12/16 Bake Indirect | 1 jobs".

    We've had to go back to 5.2.2p4 in order to bake the scene succesfully.
     
  41. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668

    I have the same problem. Setting Indirect Resolution to 0.0001 did work for me as well. What does this even mean and how is this going to affect the game? I don't know much about lighting stuff.
     
  42. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    At that small a number, it would be pretty much as if you didn't have any ambient GI. This should include the contribution and resolution of the light bounce color, color bleeds, atmospheric color, and Ambient Occlusion to some extent. You'd basically be using just the direct baked stuff; so you will have projected shadows and speculars.

    It's more or less the same difference as having a non-baked realtime game where you decided to turn off the Precomputed Realtime GI.

    You could try to split all your meshes into sections with surfaces no larger than 16m / 16m. That'll make it more likely to finish with a more reasonable indirect resolution (like 1 or 4). But that's an insane amount of work (in my case), and it will make extra drawcalls and less efficient atlases I guess.

    It sucks that 1). all this trouble happens at all, and b). you can't set the Indirect Resolution per-object like you can with the Baked Resolution.
     
    FlightOfOne likes this.
  43. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    Here are some findings (if you have a large scene):

    - Use this thing to save lightmaps in prefabs: http://forum.unity3d.com/threads/problems-with-instantiating-baked-prefabs.324514/page-5
    - Split your scene by level of light bake detail; don't try to play with individual object scale in lightmap, unity doesn't like mixing high detail stuff and low detail stuff (or something like that) (it will take ages or get stuck with no explanation).

    Just select for example the outer ring of surrounding buildings in your level, make them prefabs, bring them to a new empty scene, set your Baked Resolution to 1 instead of 40 (instead of using 'scale in lightmap') and indirect res to 0.1. Bake that and save to prefab. Then get your next tier of objects that need better light settings, take only those to a new scene and repeat till you get to the things you need at res 40 and indirect res 4.

    The issue with this is that your individual bakes won't have contribution from the stuff you are not including. So you need to get creative with that and do a lot of manual labor (that should have been avoided by Unity), and use a few bake-time placeholders for ambient contribution etc..

    Doing this reduced my bake time by a factor of 2 to 4 (and it actually finishes), though again, there's a bunch of manual labor.

    Really hope Unity gets their stuff straight and implement radial progressive realtime raytracing like they were touting a few years back in a blog post.


    PS:
    Another word of warning: Unity assigns the indirect resolution uvs on its own during bake, and if you look at them in the scene Irradiance view mode, depending on your mesh, the indirect texels will be very stretched one way. They should be projected in worldspace not object space!! If you have two walls next to each other and one is double wide, it will have stretched indirect GI!!1one
    @KEngelstoft or @Joachim_Ante please check this out. And please put up a proper "How to use Enlighten" guide, for a decent sized scene, already. Many people don't use Enlighten in their commercial products because they can't get it to work anything near reliably or don't have time to reverse-engineer it. Thanks.
     
    Last edited: Mar 15, 2016
    Kikoman90 likes this.
  44. Studvio

    Studvio

    Joined:
    Mar 11, 2016
    Posts:
    6
    "The issue of baking getting stuck on "Bake Indirect" has been found and fixed. The fix will be introduced in 5.2b4"
    I'm using version 5.3.4f1, and I'm hitting the same wall. It looks like this issue is here to stay, as it seems that nobody has a clue what's causing it.
     
  45. Foemass

    Foemass

    Joined:
    Nov 28, 2012
    Posts:
    10
    Same here on 5.3.2p4. Having to use Baked Ambient GI as a workaround. Could we get a confirmation from unity technologies on if this is being investigated? Surely enough people have chipped in here to take us seriously now, we can't all just be putting terrible settings into the lighting properties, (I hope.)
     
    Tudor likes this.
  46. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    @Foemass yes we are investigating and fixing the bugs that has been reported and we are also working on our new progressive lightmap baker that was shown at GDC.
     
    Tudor and AcidArrow like this.
  47. a_tarerra

    a_tarerra

    Joined:
    Nov 7, 2012
    Posts:
    16
    @KEngelstoft That's good to hear! I'm approaching release and are waiting for two scenes that get stuck on Bake Indirect in 5.3.4. Do you think a patch to 5.3 is likely to fix this issue within the next few weeks, or would you recommend that i revert to 5.2 where I am able to bake lightmaps for all scenes? I was also able to bake in 5.4b11 -> are these lightmaps compatible with the latest 5.3 release? Thanks for any info you can share!
     
  48. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    @a_tarerra If you are using Realtime GI, the Lighting Data asset from 5.4 is not compatible with 5.3 because 5.4 is using a newer version of Enlighten. If you are only using baked GI, you should be able to use the baked lightmaps without any issues.
     
  49. a_tarerra

    a_tarerra

    Joined:
    Nov 7, 2012
    Posts:
    16
    @KEngelstoft Thanks! We're using baked GI, so I'll give that a try.
     
  50. dpolyakov

    dpolyakov

    Joined:
    Dec 18, 2015
    Posts:
    16
    I've started having the same exact issue - Unity 5.3.5.p1