Search Unity

How to bake lightmaps on huge objects in the scene

Discussion in 'General Graphics' started by erana79, Mar 6, 2015.

  1. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    Hello!

    I got this project for mobile and created a big mesh to use as terrain (so, no Unity terrain but a large mesh).
    Baking lightmaps takes ages and stops after a while. I also get a warning that the mesh will be clamped to maximum system size.

    What's the best practice to bake lightmaps for big objects? Is there a way to manually set the lightmap size for objects individually?
    I don't really get the hang of it yet. How do you guys deal with this?

    thanks in advance!
     
    AntonioModer likes this.
  2. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    116
    Well, you can reduce the resolution on a specific object yes. Select your huge object, go to the Lighting Tab, then click the "Object" Button, and there you can adjust "Scale In Lightmap".
    At least in 4.x you could use this to reduce lightmap usage on objects that were further away. For example set it to 0.1 for the lighmap texels to be 10x bigger. I thiink..possibly.. if you change to Debug render to one of the Global illumination types(top left corner in scene view), then you should be able to see the uv resolution. Try that and see :)

    Edit: Yep, ok tested the visualizaiton of the lightmap uv's and that does not seem to work yet. At least it does not change when you adjust lightmap scale (it did in unity 4.x).
    But changing the scale does have an affect on the actual render. So yes, you can adjust "Scale In Lightmap" to reduce (or increase) the relative lightmap resolution of a specific object.
     
    Last edited: Mar 6, 2015
    cLick1338 likes this.
  3. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    Hi Hjeldnes! Thanks for your reply!
    I had to set the "Scale in Lightmap" to 0.003 to get rid of the warning - quite small :-(

    Still when i bake the scene i get stuck at "7/11 Light Transport 1 jobs". I heard about that problem on the forum a couple of times when i was still using Unity 5 beta.
    Doesn't seem to work in the released version either.
     
  4. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    Does anyone else experience the Light Transport hang?
     
    AaronC likes this.
  5. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I have had to change my workflow. And I have what I consider to be a pretty bad ass computer. I have found several smaller meshes finish quicker. And I only bake before I go to bed at night. And obviously turn 'continuous bake' the hell off!
     
    theANMATOR2b likes this.
  6. Peterko

    Peterko

    Joined:
    Aug 11, 2015
    Posts:
    3
    Hello, I'm working on something similar for somebody.. big level (240m square mesh) that needs lightmaps and having the same problem as was described here.. have this been solved somehow? I cannot find a good way how to do the lightmaps on such a big mesh as it hangs on "7/11 light transport x jobs" no matter what scale in lightmap I set
     
  7. ristophonics

    ristophonics

    Joined:
    May 23, 2014
    Posts:
    32
    I have the same problem as well and I have found a combination of all of the above will help. The mesh can be broken up into smaller pieces and or the lightmap scale can be reduced per object. Start the settings low until they work and begin to raise them till your overnight bake is hung-up<<then<< go back one.
     
  8. b4nj0

    b4nj0

    Joined:
    Jan 11, 2015
    Posts:
    39
    i have the exact same problem :(

    Edit: I asume i have the solution.

    So the root of the problem is the difference between realtime lightmap and static lightmap.
    If you set up "Scale in lightmap" in the objects lighting tab you setup the size for the static lightmap.
    Thats why you dont see a difference in the lightmap chart view and thats why it seems to have no effect on bake time.

    In order to lower the size of the realtime lightmap you need to go into the objects lighting tab and look for "Advanced Parameters".
    You can either choose one of the presets or you create a new preset.
    In this preset you can modifiy the realtime lightmap scale and you will also see the effects in bake time and uv-chartview.

    I dont know if thats the solution for all of your problems/questions but i hope this helps someone
     
    Last edited: Dec 27, 2015
    tnaseem, nodeway and AaronC like this.
  9. pachermann

    pachermann

    Joined:
    Dec 18, 2013
    Posts:
    133
    I need to remake this answer since i found out that i was just doing it wrong...

    If your light transport stops at 7/11 you may reconsider the Size of your maps and just start over!. There is no such bug!

    This is just how i managed to bake ;) there might be ever more tecniques and i would be glad for any other aproaches!

    Remake the Scene and put all parts to size 1. (static objects) (lights baked or mixed)
    Be sure you have UVS otherwise it wont render at all.

    if u have complex objects be sure your polygroups are merged and don¨'t have to small pieces floating around.

    also very important if you need backfaces don't do it with mirrored polygons use a shader that does it. Remove any not seen polygon on the backside of your faces.
    polygons that are very near to each other can produce nasty stuff its called z-fighting or just selfshadowing artefacts does unreasonable scalings.

    have clean modells ;)

    also very useful is to chunk up bigger models into meshgroups that have like same sizes. (it worked for me)

    group the bake systems together you can do this as following:



    You will see when the groupings of the Meshgroups look ok and have same sizes.
    And then keep the baker setting low and the resolution down for the meshgroups.


    Also don't use Finalgather in the beginning, i did this settings to start.
    also try to make very small realtime resolution its quite low and it will work specially on small stuff.
    Just use lower settings till it works and you have good looking maps:



    I hop this gets people on the track :)

    with this setting my machine with i5 6 years old i have like 15mins baking time :D

    some other things i did not figure out and are weird:

    - can't find the lightmaps itself, be sure you keep on the baker when u press play to test it.
    - keep on the auto baker also when doing a build or you wont have the maps in the .exe

    enjoy Unity 5 :p

    best, Pascal
     
    Last edited: Feb 13, 2017
  10. ohkookhwan

    ohkookhwan

    Joined:
    May 22, 2017
    Posts:
    1
    Hello,
    I made huge Size terrains (4000x4000 resolution) x 8 terrains
    It was not baked at first time, It's stuck at 2/11 System. So I am using the split tool for terrains 1/4 size but couldn't bake either.
    I found something that It has a tag for the manual bake the system.
    Create the 8 lightmap parameters and Changed System Tag to 0~8, After changing terrain light parameters option.
    Now I can bake huge map.
    I think Unity Auto generate option is too bad. It just works for small Size contents.
    Ah.. One more thing... Before baking Huge size map Should Clear GI cache
    Edit ->Preferences -> GI cache -> Clear, Set the Cache size to 200GB , it works for me.
    Sometimes it's not working, then after Clear cache, Close the unity, open again then it's work.
     
    Last edited: May 22, 2017
  11. macanannym

    macanannym

    Joined:
    Aug 25, 2017
    Posts:
    1
  12. khalidzamanabbasi1947

    khalidzamanabbasi1947

    Joined:
    Mar 30, 2021
    Posts:
    2
    hello,
    i have issue on baking. i baked my environment but its generating more than 2000 lightmaps i want decrease them .can anyone help in this issue please
     
  13. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
    Increate lightmap size in lighting window... then reduce lightmap resolution if needed