Search Unity

Baking lightmap for Area Lights - 24h later

Discussion in 'Global Illumination' started by Ibzy, Jan 27, 2016.

  1. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    So for the first time I'm trying to deal with area lights, and as such need to bake a lightmap.

    I have a fairly small and basic scene (some walls, floors, ceiling - the usual) with a handful of area lights being cast from the ceiling. All items are flagged as lightmap static (as they will all receive light) and that's as far as I've got.

    I clicked "Bake"/"Create" this time last night, and have been met with a small array of errors:

    and also THIS is still showing:

    If I can't even get a preliminary bake to complete, how am I supposed to tweak it to look half decent?

    Using Unity5.2.3f1 (x32) in Windows 10 (x64) - Unity x64 wouldn't let me import sounds...

    Chers
     
  2. thefranke

    thefranke

    Unity Technologies

    Joined:
    Jun 20, 2015
    Posts:
    153
    Hey Ibzi,

    do you have a small demo-scene were this issue pops up that you can share?

    Cheers
     
  3. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    I am curious about the memory usage at the time of the error. Could we see a screenshot of your memory usage (task manager)?

    Also, very curious about "...wouldn't let me import sounds..."
     
  4. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    I'll try to get a sample scene built for smaller scale testing - it may well just be my installation/setup.

    I'll run it and take a screenshot and post it in about an hour - I've switched them all to emissive textures in the meantime (with an even stranger issue to cover) so will have to bring them back.

    And the importing of sounds, I think there were a few people with a similar issue to do with FSB tools. I uninstalled 64bit and installed the 32bit and it worked fine.

    Thanks guys.
     
  5. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Ok, make that 6 hours.



    This is while baking with no area lights, just emissive materials (which should be realtime?) error message appeared shortly after this was taken, and memory usage was jumping to almost 4000MB - so I think your assumption is correct here Mike in that it is a memory issue.
     
  6. thefranke

    thefranke

    Unity Technologies

    Joined:
    Jun 20, 2015
    Posts:
    153
    Hi Ibzy,

    I have two seemingly unrelated questions: Do you have enough free harddisk space available on the disk your project folder resides on? Is there by any chance any antivirus software/"cleaner" active (I think I see AVG running in your screenshot)?

    Cheers

    PS: Emissive materials can be realtime, but they can also be baked statically; depends on your settings.
     
  7. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Hey,

    Firstly, plenty of hard disk space (several GB, cant remember actuals but it is a large enough amount) AVG is "active" in the sense that it's running in the background as protection (not running a scan or anything).

    I am hoping I have the correct settings - there isn't a choice in the emissive material to choose realtime./baked is there?

    Thanks
     
  8. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    So, a little bit of testing:


    This is how I expect it to look - light shone from the sphere within a certain range. I have used a spotlight to get this effect.


    This is how it looks without the spotlight. Emissive texture settings included.

    And here are the lighting settings. The Object settings are applied to all objects visible in the above scene.

    I did try baking for an area light in this tiny scene and it did work, so I'm assuming the other scene is too big for available resources?

    Cheers
     
  9. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    Can you zip and upload your simple project so I can try it out? I would like to rule out a project issue versus and installation / system issue.

    Also, it may be worth updating to determine if this is a 5.2 bug (5.2 had lighting bugs as far as I am aware).
     
  10. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Will do when I get home (curse this day job!)

    As you think there were existing lighting bugs, I'll zip it up then update and try again. If it still struggles (also with a new project to be sure) I'll upload the project for you to take a look at.

    Thanks
     
  11. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Ok, so i've updated to the newest version and I'm not sure if it's fully crashed or if it just takes a while on first load?

    Will leave it going for a while and see what happens.
     
  12. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Ok, so the short answer is: I can't do jack with Unity 5.3.x. I've tried the last 2 builds (Jan16 and Dec15) both x64 and x86, and neither want to play ball. 64bit crashes on the splash screen (just hangs, no error or anything, just stops responding there) and the 32bit loads a blank scene (despite clicking to open a specific .unity scene) and crashes when switching to a proper scene.
     
  13. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    Can you give us a copy of the project? I can't do much without seeing it.
     
  14. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Yeah, sorry about that - I was hoping to be able to open the project and drop it down to the necessities before bundling it up and sending it.

    I've uploaded a zipped project to www.ibzy.co.uk/Downloads/VOID/Cardboard%20Test1.zip

    Please let me know when you've picked it up so I can take it down.

    Thanks
     
  15. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    Ok I've downloaded it. Let me look it over.
     
  16. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    OK, I deleted all old lightmaps (folders that share a name with the scenes). Then I set the glowing orb to static (emissive objects need to be static in order to shine light). Then I baked realtime GI lightmaps (I turned off baked lightmaps just to make sure it works as realtime). Baked right away with no issues. I am on 5.3.1p3
     
  17. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    Also, I was also able to bake your larger scene. It took a very long time (and I'm on a beast machine). I reduced the realtime resolution to .5 and the baked resolution to 2. Then it finished in 2 minutes. That is a very long time for those settings, so just understand that your scene is very complex. Simplifying geometry or reducing resolution / number of baked objects would speed things up. In a nutshell, keep your settings very low until you are all done then do one final "good" bake
     
    Ibzy likes this.
  18. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Thanks Mike, looks like its an issue with my install then, or my machine as a whole. I still cant get 5.3.1 or 5.3.2 to run in 64 bit, and 32 bit crashes when I change scene in the editor.

    How does the baking work with regards to realtime GI? I mean, the idea of realtime is that it's not baked...right? I might just be massively confused around terminology on this one to be honest, but I didnt think I needed to bake for the realtime illumination.

    Not sure what makes the scene so complex as it is all very straight "cubes" and quads. The only non-primitive with regards to geometry is the 2 small info plinths..unless I accidentally set all my floating cubes to static too.

    Oh, and I genuinely thought I'd set the orb to static. Or does it need all-static (I'd just set lightmap static)?
     
  19. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Good news: I got Unity loading up again!

    Did a full malware sweep (found a few bits of tat like tracking cookies and such), uninstalled Unity,rebooted (twice), and then Installed 5.3.2 64bit and boom! Success!

    I've got the sphere lighting up with baking which is ace, and I'm running through the main scene now.

    Now that's working - back to the initial question: How do I set the emissive texture up so that I can see the lighting changes as I re-position it? Am I getting confused by the term "realtime" in that I think it should adjust like a direcitonal light?

    Cheers
     
    thefranke likes this.
  20. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    I'll respond to your other points tomorrow as it is late right now. I just wanted to mention that your scene isn't as simple as you think. Running the profiler, I see that there are

    1192 game objects in the scene
    14% overhead going to rendering alone
    Up to 114 meshes being lit
    Most meshes are static (so they count into baked)
    And you're in deferred rendering on Android

    That's a lot! Certainly I've seen more, but that does come with a light calculation cost.
     
  21. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    No problem, I keep forgetting time differences are a thing.

    So it baked:


    Artefacts over there, but I'm assuming thats due to the low quality bake settings?

    I get the feeling I need to do some research on scene optimisation - any tutorial suggestions? Will also try to understand what the profiler is telling me too.

    Thanks again.
     
  22. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    247
    Those artifacts could be due to bake settings, UV coordinates, or render settings. You will have to play around and see. FYI, you can adjust the per-item resolution under the Object tab in the Lighting window.

    Regarding realtime GI versus baked. Simply speaking, lightmapping is two phases. 1) calculating surface values and 2) calculating light bounces. Realtime GI is "baked" in that the first part is already done. True baked lighting does both 1 and 2.
    The trade off is that realtime GI still requires static objects and comes with the limitations of baked lighting, but it will react and change to realtime lights. Baked won't.

    Finally, you need to set an object to static for it to shine an emissive light. Static objects can't be moved at runtime. Therefore, you can't move an emissive light while running and also have it shine light. That you will have to fake with point lights or such. Now, if you mean moving it in the editor not at run time, simply move it and rebake.
     
  23. Ibzy

    Ibzy

    Joined:
    Sep 15, 2013
    Posts:
    112
    Thanks Mike, that makes a lot more sense now. So "Realtime GI" refers to the fact that the lightmap will still react to realtime lighting.

    I'm assuming that should the baking take an immense amount of time, this wont have any negative effect on performance? Obviously I could get a similar effect using point lights, but the cost to performance (especially on Android) could be a game breaker on older devices, correct?

    Moving the emissive object and seeing the change, I suppose I can just set baking to Auto while the settings are low.

    I'll have a play and see what performance differences I see with the difference approaches.

    Cheers