Search Unity

Unity Crash when Baking Lightmap

Discussion in 'Editor & General Support' started by AnimalAsLeader, Mar 13, 2019.

  1. AnimalAsLeader

    AnimalAsLeader

    Joined:
    Aug 16, 2018
    Posts:
    8
    Hey!

    As the title says, Unity3D keeps crashing when I try to bake lightmaps.
    Im using 2018.3
    At first I thought it could be due to too many lights, but it still happens when I remove all lights and add emissive materials.

    Another problem of the emissive materials is that they are very bright, but everything around them is still dark, as for some reason even at max intensity the light doesn't get very far. (even when I put 4 bounces in the lighting explorer)

    help would be appreciated.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What does the editor log reveal?
     
  3. AnimalAsLeader

    AnimalAsLeader

    Joined:
    Aug 16, 2018
    Posts:
    8
    Haven't checked.
    Does the log clear once you exit Unity? If so, it won't help me.


    EDIT: It's possible that it's just because the Baking killed my CPU... I tried the GPU one and it finished the baking.
     
    Last edited: Mar 13, 2019
  4. RonniNielsen

    RonniNielsen

    Joined:
    Aug 7, 2017
    Posts:
    2
    I have the same problem in 2018.3 where auto generate baked lighting causes Unity to crash after a few seconds after startup
     
  5. ColbySg89

    ColbySg89

    Joined:
    Mar 26, 2015
    Posts:
    15
    So I'm not sure if this is still an issue but usually this happens to me when I am running a game while I am working in unity and I run out of GPU memory or Ram memory. In order to avoid this whenever I was baking lights I always close everything other than the Unity Editor prior to baking the lightmaps. This stopped the crashing for me. Photoshop is a big resource consumer so I also had issues with running out of RAM with that open. Another solution is to dial back the resolution of the lightmap and draw calls but obviously this will reduce the quality of lighting.
     
    FlightOfOne likes this.
  6. ZomBJ

    ZomBJ

    Joined:
    Jun 28, 2014
    Posts:
    7
    Dunno if you guys every found a fix, but I literally cannot bake lights at all right now. The moment I click bake it just instantly pops up with the Unity bug report dialog, which itself crashes when I hit send. I don't get a chance to see what the error is. Is there a way to pull the log back up. I have tried changing all the settings per various forum posts and nothing works.

    It's also probably worth mentioning that light baking was never an issue until I updated Unity. Since I started using 2018, it was about a 50/50 shot that I could bake lights without crashing, no matter what the settings were. In the last few days, not a single lightmap has been able to bake.

    Not my PC as far as I can tell, considering lightmaps were never a problem in the last version and the rendering never even gets a chance to start, it literally crashes upon clicking bake. Even when it was working half the time, if I clicked and it didn't instantly give me a crash and the bug report window, it would bake just fine.
     
  7. Slimmy

    Slimmy

    Joined:
    Apr 25, 2017
    Posts:
    21
    Have the same issue and am rolling Unity version 2018.2.16
     
  8. Slimmy

    Slimmy

    Joined:
    Apr 25, 2017
    Posts:
    21
    I upgraded to Unity v.2018.4.8 since my project and installation was corrupted somehow. Not sure what happened. I switched from progressive to enlighten and that seems to have done the trick. Seems as though progressive was set by default. Maybe after my last update of Unity. Hope this can help someone else.
     
  9. lairlair

    lairlair

    Joined:
    Oct 16, 2019
    Posts:
    8
    Happened to me too. In the few seconds where unity was still running I disabled the "static" parameter on the top right hand corner of the inspector. After I disabled this for all the objects in my scene it ran again and I was able to investigate. The problem in my scene was that I had a pointcloud in it, and it seems to be terrible for global illumination. I received a ton of errors (probs one for each point) in the console. So if you have a pointclound or any asset of that kind, maybe don't use GI on it?
     
  10. Felgryn

    Felgryn

    Joined:
    Apr 17, 2018
    Posts:
    1
    Similar issue for me, i am working with Gaia Procedural worlds and Unity version 2019.3.12F1. I can go pretty far in creating a world - but when i try and bake lighting - even quick bake - it crashes. Has happened four times now. Uploading a report to Unity (my, it takes a while to load a report.... )
     
  11. eovento

    eovento

    Joined:
    Feb 22, 2018
    Posts:
    38
    Thank you, @Slimmy !
    Both Progressive CPU and GPU were not working for me (CPU i9 and GPU RTX 2080). It was crashing Unity in a few seconds after beginning. And changing Lightmapper to Enlighten, as you suggested, kept it working.

    I had nothing else eating up my computer resources. Unity was the only application. And my machine is more than capable and my scene is also not the most complicated. It's a big outdoor scene with hundreds of static objects, but only one light - the main directional one. I have no idea why Unity is crashing.

    I have also received this message on my console:
    Baked lightmap filtering failed. Try disabling the Optix denoiser or lower the lightmap resolution."

    I lowered the lightmap size to 256, but have no idea how to disable "optix denoiser". I could not find info on this anywhere. Does anyone know? (AIt kept on crashing on Progressive, even lowering lightmap size to 256.)
     
  12. answer.PNG
    I think they're talking about the Direct (or the Indirect) Denoiser setting. (I have no things in this project, so these aren't real light-mapper settings on my screenshot... I haven't run the light-mapper)
     
  13. dragonash2018

    dragonash2018

    Joined:
    Jun 3, 2019
    Posts:
    1
    Same issue here. Using 2018.4.20f1 for VRC worlds. It was working fine until tried to organize my hierarchy into groups.
    Create an empty child object and place other objects inside of it - like Walls, and place all the wall objects in it.

    When I went to generate lighting, unity closed out after a few seconds. I've used Progressive CPU and Progressive GPU with no luck (I used GPU all the time with my RTX2080 because it flew through light generating).

    Enlighten doesn't work either

    I have since undid those groupings and deleted the child objects, but still encounter the error. This has completely halted my progress since I can no longer upload any changes that deal with lighting
     

    Attached Files:

    Ohmydumbledear likes this.
  14. hptware

    hptware

    Joined:
    Dec 11, 2012
    Posts:
    107
    Same issue here with 2019.4.8. Unity was working fine, then it began crashing every time I tried baking the lightmap. Setting different types of processing (Progressive CPU/GPU and Enlighten) all still crash the editor. All new scenes, including the default URP scene crash with light mapping, even a completely empty scene crashes. I also notice that many prefabs have lost their materials in preview images but have materials when dragged into the scene. My laptop is more than capable of running unity (and has been for 6 months).

    Previously created scenes with autogenerate lighting crash on start-up. However, I discovered a way to edit the scene definition file to turn off autogenerate (scene.unity file) by setting GIWorkflowMode to zero from 1.

    I've tried reinstalling unity but the problem persists suggesting it is a shared dll that isn't uninstalled that is corrupt, presumably owing to improper shutdown of unity on one occasion, or there is a conflict. Is there a way to fix unity or perform a complete uninstall? This is the first major issue I've had with Unity in 10 years of using it, and typically it happens when I have a short deadline.
     
    AveryWolf likes this.
  15. Snowirbis

    Snowirbis

    Joined:
    Jan 30, 2018
    Posts:
    5
    Same issue after upgrading to 2020.1 (progressive cpu was working on 2019.3).
    Guess I need to rollback.
    I tried disabling 75% of my objects and lights, but it still crashes 1 second after clicking on Generate Lighting
    So I guess it's not a resource problem but a bug
     
  16. hptware

    hptware

    Joined:
    Dec 11, 2012
    Posts:
    107
    Just for info. I discovered my problem was with an error in a DLL associated with my onboard graphic card rather than unity. It was listed in the editor error log.
     
  17. danmerkel

    danmerkel

    Joined:
    Feb 10, 2020
    Posts:
    1
    Solved here!!
    I had the same problem and managed to solve it.
    Open the project directory and delete the library folder, this will make unity reimport everything when you open the project. After reimporting the entire project the problem disappeared and lightmap baking went back to work.
     
    Deleted User likes this.
  18. Hypertectonic

    Hypertectonic

    Joined:
    Dec 16, 2016
    Posts:
    75
    I was having unavoidable crashes when baking a project. It originally worked without issues and one day it just wouldn't bake.
    • Tried rebuilding library
    • Tried updating Unity
    • Tried reinstalling GPU drivers
    • Tried checking system integrity (it was fine)
    • Tried baking on another computer (I suspected HDD or driver issues)
    None of those worked.

    For some reason I decided to check on the meshes import settings, and I saw on one of them the import settings had been changed at some point to not generate Lightmap UVs, and this mesh was used in objects set as static in the scene. Once that was fixed baking proceeded as usual.

    I recall Unity used to drop a warning when objects had no lightmap UVs, instead of crashing. Gonna submit this as a bug. This was in 2019.4.9 and 2019.4.10.
     
  19. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    My Editor 2021.1.8 with HDRP crashes when baking lighting on GPU.
    With enabled denoiser it already crashes when baking a few m² with 100 textels/unit.
    When I disable denoisers it crashes later.
    My scene is just a few Unity-Cubes, no custom geometry.
    Pretty sure it´s a memory issue.

    Impossible to use it for larger scenes.

    Any ideas?