Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Lightmapping terrains... hopeless!

Discussion in 'Unity 5 Pre-order Beta' started by AustinRichards, Dec 13, 2014.

  1. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    I have been trying to lightmap my scene. It has a 3000x3000 completely flat terrain. The scene lightmaps very quickly when I turn the terrain off in lightmapping. As soon as I try to lightmap the scene with the terrain, it always takes an eternity on clustering, then once it finishes that it just gets stuck everytime on the 7/11 light transport. I've left it on for 40+ hours and it will not finish it. I have tweaked with the settings and tried everything, including making a scene from scratch, getting a 3000x3000 fresh terrain and baking it. still no luck. I can bake a fresh 500x500 or 1000x1000 terrain in less than a minute, but 3000x3000? forget it.

    Also, not long ago, It WAS working. Previously I had a bridge and the terrain. It would lightmap very quickly and be fine. As soon as i added a sphere primitive (from create->3d objects-> sphere) and set it to static, it would then take an eternity and get stuck on 7/11 light transport. When I deleted the sphere, and lightmapped again, it would work and only take a moment! I then deleted the unity GI cache and restarted unity. Since deleting the cache and sort of refreshing the gi, I haven't been able to get this to work.

    Why do terrains take way longer to lightmap than a mesh the same size?

    I don't see why this takes so long, then gets stuck. It's a simple 100% flat terrain. If i make a plane thats 3000x3000 and bake it... It works and is much quicker. Seeking all help, tips, and advice! If there's any way to REALLY crank the resolution down on the terrain during lightmapping (I've tried everything I could find such as lightmap perameters, # of texels, scale in lightmap etc) let me know! I've been trying to fix this for days!

    (Using unity 5 B17, issue was on 16 too, unsure about 15 and lower)
     
  2. hamyshank

    hamyshank

    Joined:
    Jan 31, 2013
    Posts:
    88
    Same here I've just unchecked static for the terrain. I've not tried manual baking it though.
     
  3. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    Whats the light map resolution on your terrain? I've ran into this issue too, takes ridiculously long to lightmap terrain. Then if you go change anything in the scene, it's like it has to bake the whole thing again. You would think it would lightmap it in chunks, but i guess not.

    I've been trying to use unity terrain lately and it's pretty pathetic. Can't believe they have not replaced this 1999-esque terrain system yet. Without standard shader on the terrain, its going to look completely out of place in unity 5.
     
    LaserWzzrd likes this.
  4. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    Yes, I agree - lightmapping a terrain is beyond frustrating and completely unusable at the moment, even at the default lowest settings. Previous comments on this have brought several suggestions to make it better, but I have been completely unable to ever finish light mapping a terrain - even at lowest settings and waiting a full day. And if you do anything at all in the scene, it gives up and starts over. I'd rather they hooked beast back up. I could light map a terrain in a few minutes with that.
     
    LaserWzzrd and p87 like this.
  5. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Glad to see I'm not the only one with this issue... but disappointing this is an issue!
    The terrain system is pretty awful now. It needs to be redesigned and support painting materials, as well as increased performance with grass, (trees aren't that good in my opinion either I don't use it anyways though), and the ability to drag the edges of the terrain to make it bigger or smaller without completely ruining the terrain data. I just want a terrain that you can change the size of without ruining the terrain data and keeping the same resolution per unit, painting materials or at least 3rd/4th slots in the texture window (honestly, not the big problem with the terrain, but would make it incredible), and most importantly much better speed...

    But anyway, back to the light mapping....

    This light mapping issue is terrible, and I really hope Unity devs get this fixed by beta 18, because as you guys said, it is unusable.
     
    LaserWzzrd and p87 like this.
  6. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    I have the same issue. I'm working around it by unchecking static light maps on the terrain.
     
  7. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Same here, but it's not a work around... it's simply not light mapping so much of the scene.
     
    LaserWzzrd likes this.
  8. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Been an issue since B1, they're working on it guys.
     
  9. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Thanks! Hopefully they fix it by b18
     
  10. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    Left it running all weekend. Still at "2/11 Layout Systems", and it appears to be running (or at least using "251%" of the CPU). I know it's alpha level software, but I hope they are able to get this knocked out soon.
     
    carking1996 likes this.
  11. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    We are aware that terrain lightmap baking still needs lots of work to make it practically usable and we are constantly working on that.

    We've done some local tests on dev machines and though super big terrain (3000x3000, heightmap resolution 2049) takes like half an hour or so to bake we don't get hang-up at least... Could you please submit the terrain that hangs the baking process to us for an investigation?

    Also here is some discoveries from my side:
    * If you stuck at 2/11 Layout stage, and your terrain has a high heightmap resolution, you probably can find another machine with more RAM installed to bake (Reasoning: The generated Enlighten geometry can be quite big if terrain is densely tessellated. And at that stage our current implementation needs to load up all the geometries into the memory. So I'd guess more physical memory can be used).
    * If you stuck at 5/11 Clustering, and if you have a tiny terrain (say 1x1 or 5x5), try INCREASE the bake resolution...otherwise try the lowest possible resolution (you can leave the cluster resolution since the actual cluster size is based on resolution * cluster resolution)
    * Generally we found if your terrain doesn't have a high heightmap resolution usually the bake time can be controlled reasonably by adjusting the bake resolution.
     
    LaserWzzrd likes this.
  12. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Can you define what the best settings at the moment? at least we can keep it around that..
     
    LaserWzzrd likes this.
  13. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    All I did was load the scene from this asset:

    https://www.assetstore.unity3d.com/en/#!/content/12682

    Hit "Upgrade to enlighten", and hit bake. The defaults were set at "very low". The terrain is only 500x500, and the resolution is 2049.

    Edit: Tried from a different machine (this time one with 24gb of RAM instead of 16GB). I'm 3 hours into baking, still at 2/11 layout systems. CPU is running over 400% (yes, I'm on a mac, and that's how it counts it). Memory is hovering around 15GB. I'll let it run over night...
     
    Last edited: Dec 21, 2014
  14. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    Try create a lightmap parameter asset, copy vales from the built-in "VeryLow" preset and specify an even lower Irradiance Budget and Irradiance Quality value. But even with this I can only bake the terrain (by disabling all other objects in the scene) in like 1.5 hours. I'm quite sure we'll get stuck forever if we bake the whole scene. I'll report to GI team and see what we can do here.
     
    LaserWzzrd likes this.
  15. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    I tried baking my terrain (new terrain, 3000x3000 2149 resolution). In about 20-30 minutes it'll bake fine (Still longer than I'd like for "Very low resolution"..)

    The issue is when you add other objects to the scene. I then added a few cubes with regular diffuse materials throughout the terrain (probably about 3/4 total). Now when I try to bake them it will go all night and no success.

    This morning I saw it was stuck on light transport 7/11. Then I am not sure exactly what happened but I was messing around with things then I believe it finished all of a sudden. It reminded me of tapping a computer and it getting its act together. But since then I haven't been able to reproduce that and get it to fully bake. It always gets stuck on light transport when multiple objects are in the scene along with a terrain.
     
  16. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Filed a bug report, Case 658281
     
    LaserWzzrd likes this.
  17. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    I think it's just unusable atm with huge objects like terrains. You might get the terrain to bake, but then you put in a few objects on the terrain and then it has to rebake the whole thing and 3 tiny objects causes it to take 3 times longer to bake.

    Really if you play around with enlighten, I have not been able to get it to look remotely good unless I'm using very primitive shapes and models. I admit this might have an element of user-error to it, since there's no helpful guide or best practices documentation provided. The beta documentation sucks and has not been updated since beta 8 or so.

    Terrain is kind of a horrible way to play around with GI, currently. I've been using probuilder to make primitive shapes and blockout levels, and the GI bakes at a decent speed. As the complexity of your scene increases, enlighten takes longer and longer to bake each time. Even with a scene full of primitive cubes it can quickly slow down enlighten. I have no idea what they plan on doing about huge terrains, lol.
     
    Last edited: Dec 22, 2014
  18. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Yeah it is unusable. Just gotta wait on them to fix it up. They are very far from being ready to release 5.0.
     
    LaserWzzrd likes this.