Search Unity

Unity hangs on lightmap creation 'Application has run out of memory'

Discussion in 'Global Illumination' started by metaphysician, Aug 9, 2017.

  1. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hey folks - i'm having a devil of a time baking GI in a large scene using either Progressive or Enlighten methods. basically i've taken two directional lights and set them to baked and changed very little. i did adjust the GI Cache size to about 90GB on another drive. the first time i selected all my trees and the terrain and used Enlighten. that took about about 20 hours before it gave up the ghost with that message. the cache was smaller so i changed its size and i moved the cache location to a larger drive. the next time i decided to use Progressive Lightmapping. set it for Indirect and only do it on the terrain. this took less time but still ends with the warning message while Unity 'pauses' - aka almost crashes.

    is GI baking an all or nothing proposition? my terrain mesh is quite large, split into 3 pieces due to triangle count. is there a way to optimize this so that the baking process can go through? or do more than one lightmap? any tips would be very appreciated.

    Additionally just a tip - if you change the GI Cache location make sure you have a folder selected on your drive. i did not, so i accidentally selected the root level of the drive. bad bad mistake. after it had to be force quit, Unity would start, but any project that would be opened the baking would immediately start, creating cache folders on the drive, and within seconds Unity would crash. after several restarts, repairing disk permissions, and deleting literally every Unity based config and/or preference file in the system, and reinstalling Unity from scratch, only to have the problem re-occur, i had to create a new project, and adjust the project GI Cache settings properly before it became stable again. NOT fun.

    any nice tutorials on this sort of thing one would recommend, besides the Unity Learn ones? i'm definitely a noob regarding GI and baking.
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    Try a really really low lightmap resolution and see if that bakes.
     
  3. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    thanks for the advice! the low resolution did the trick. i saw the tutorial on Computing lighting for Mixed Progressive and they mentioned low values but i wasn't sure if it applied to purely baked. took a couple of hours but no issues.
     
  4. dmitry-K

    dmitry-K

    Joined:
    Apr 2, 2014
    Posts:
    26
    Is it possible to make more then low resolution, without any memory leak problems?
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    What?
     
  6. dmitry-K

    dmitry-K

    Joined:
    Apr 2, 2014
    Posts:
    26
    I have two big terrains, about hundred objects, and about 200trees in my scene , and I cannot make lightmap resolution more then 3, without any error like "out of memory".
    Is it possible to make lightmap resolution bigger?