Search Unity

Enlighten Baking is too slow

Discussion in 'Editor & General Support' started by zenGarden, Jan 1, 2016.

  1. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi,

    I quickly made a complete terrain using Gaia plugin, then i launched the light baking with common settings, 5 hours later it was still not finished :eek:
    Each time i would move or add a house and some rocks this means i'll have to wait 5 hours to preview it for the final game.

    Enlighten can be good for small games or mobile, but for large levels some of us don't want to wait hours or a day. So i just switch to real time lighetning without GI in that case of big outdoors.

    I would like to know if Unity will consider some alternative to enlighten ? A real time solution like SVOGI staying fast enought on common computers ? Or someting faster to bake like lights probes 3D grids ?
     
    IgorAherne likes this.
  2. Philip-Rowlands

    Philip-Rowlands

    Joined:
    May 13, 2013
    Posts:
    353
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    You'll wait less than 5 hours if you have GI cache enabled, but it will still take forever.

    A single building can easily take 12 hours or more (well, my hardware isn't top notch, but still), so you'll really want to leave computer overnight. Something like Final Gather can explosively increase memory consumption, etc.

    There was discussion about that in some thread which was started around the time where Unity dropped Beast and added Enlighten, the overall vibe was that Unity team is not going to bring Beast back.

    You may want to investigate external lightmap baking route (Unity tech mentioned that there's still api for external baker).
     
  4. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I don't ask Beast return, but i would like to know if Unity could plan some real time solution not based on Enligten.
    Cryteck has done it , it works, it looks good enougt and lot better than a non GI lightening.
    Why Unity engineers could be be able too ?
     
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I feel your pain -- if you're just wanting light maps, then Unity 5 took a big step backward (trees don't even bake shadows anymore). But, it's not going to change. Best thing to do is to just grin and bear it, and try to work around the issues. For terrain turning the settings *way* down is about all you can do.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    Set the terrain lightmap parameters to very low
     
  7. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It was already on lowest, the terrain lightmap (1024*1024) is made fast because it don't bake any trees, rocks or houses. Still all these static objects are too long to bake.

    I am not asking a work arounds , i am asking if Unity will plan in 2016 a non baking based workflow ? It is a simple question.
     
    Last edited: Jan 1, 2016
  8. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    My solution don't bake in unity, use something else if you must bake.
     
  9. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    You don't make your levels in your modeler. Non baked lightening is the way to not bake.
     
  10. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Yup I'm guilty of this. But I'd rather that than unity baking. What modeler are you using?
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    I don't know (since I don't work for unity), but the general feeling was that they were gonna stick with Enlighten. The thread was quite old, though.

    As far as I know Crytek's engine is a complete disaster when it comes to documentation and community support. Highly experimental poorly explained stuff. Or that's what I heard. That's not a good comparison, really.

    I have impression that with switch to version 5 engine hit MOUNTAIN of problems, so if they're gonna improve anything about lightmap baking, that won't be soon. You could check the roadmap though.

    "Light probe grid" is scheduled for March 2016, while "Global Illumination: Progressive Lightmap Baking" and "Global Illumination: Distributed LAN lighting builds" are in "indevelopment phase" with no forecast.

    Either way, this might be of interest:
    http://polycount.com/discussion/156075/enlighten-in-unity-5

    Alternatively, you could drop standard shader and bake lightmaps externally using something like blender cycles.
     
    theANMATOR2b likes this.
  12. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    We know that already, but at least they stick with real time non baked solutions.

    Moutain of problem is what happens when there is dragstic changes, we just need Unity to return to a good state less broken with next releases.

    This has been used in some AAA games, if it can scale with large terrains and offering a better lightening than simple dynamic shadows, this could become the new way for non baked games.

    Baked will stay the better compromise between a good GI quality and a good frame rate, so people doing mobile games or Archi Viz guys should be happy.


    This won't work as workflow, because you don't place your prefabs in Blender , and it is lot of work under Blender while Unity makes second UV maps for you.

    I had a test with Unity real time GI demo, it is broken with some lightening flickerings

    And vertex display bugs


    The shader used is not Unity PBR but DirSpecHalfLambert and the demo is too slow on GTX 960.

    Perhaps the incoming light probes grid will be fast and good enougt for general usage.
     
  13. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    I'd expect this to take a year or two. Waiting is not a good option when you need stuff to be done NOW.

    I can't remember even ONE title using Crytek engine that was not farcry or crysis. After digging around for a while, I found out that I actually played Crytek engine game which was State of Decay.
    The engine appears to be geared towards one type of environments, and is hard to use in addition to that.

    Erm, it will. You'll need to write scripts for that, though.

    Your entire unity scene graph is readable from C# script, down to the vertex level, basically collapse the scene into mesh, send it into blender, render lightmaps, grab them into unity. It probably won't be fully automatic, but should be doable. It might be possible to automate that thing by writing a python script on blender site.

    The thread with complaints against Enlgihten (and questions about possibly bringing Beast back) mentioned referenced api for that kind of thing. Basically lightmap index, lightmap offset/scale, etc.
     
  14. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Why making it in Blender ? Unity should support all existing modelers if they would do that.
    And many people will not be able to use Blender that is too complicated , they will stay with Unity easy level design.

    I didn't mean Cryteck engine, games only
    https://bartwronski.files.wordpress.com/2014/05/assassin_s-creed-4-digital-dragons-2014-no_notes.pdf
     
  15. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Because it was the first solution I could think of that is relatively easy to implement and will work.
    Blender renderer supports texture baking, photon mapping and light bounces, plus its api is exposed to python which is relatively easy to use.

    That's unreasonable.

    Number of existing modeling packages is large and I won't be able to even list all of them.
    There's at least 20 different software packages around.

    The feature is not available NOW.
    No matter what you do, it will not become available right NOW, and even in the best case scenario you'll only get it in 6 months or something like that.
    So your choice is to either give up on having lightmaps, or connect some other software that can bake lightmaps to unity. Blender is one of the candidates.
     
  16. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I never asked a Blender level design solution, and i prefer using Unity editor.

    This is the whole subject here leaving lightmaps away :rolleyes:
    If Unity brings a successfull light probes grid solution that don't need lightmaps, this will be a success from my perspective.
     
  17. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I feel how out of control with unity lighting baking, no idea on good settings for terrain size, meshes etc.. someone ever done a 'non video guide' on screenshots and actual information (unity manual eergh). Getting tired of all the videos where useful information maybe buried somewhere along the timeline.

    Unity its like watch a little line on the screen with no idea or estimate in total time its going to take to finish. For newbies its easy to make mistakes with light baking taking ages without unity providing any notices to users that.. oh look ...this S*** has taken while hasn't it.. hey your terrain is effing huge, and your settings are whack, have you thought about adjusting this buried setting over here to a value around this <value that has been previously tested to work with terrain that size).. it should be good enough in quality and not take this <insert hours/days> effing long. Another thing (which I dunno if its been fixed or not) is not turning a users pc into a brick while baking, last time I had it running I noticed some of the separate threads running taking up full core usage were on above normal priority. .sorry but low priority is where I want it, that way I can still actually work on the pc.

    "I've found that setting the lightmap resolution scale to e.g. 0.05 helps. Here's where I found that suggestion."
    heh yeh i think i found an answer like that after searching '7/11 Light Transport' on unity a while back myself :)
     
  18. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Incorrect I'm afraid. You shouldn't be placing your prefabs in blender, you should be doing it the other way way, dropping your entire level from blender into unity. I can't honestly imagine anyone finds unity quicker for designing levels, well, 3d ones anyway, (no asset store plugins assumed of course). ;)

    Also with cgcookie's bake tool.
    https://cgcookiemarkets.com/all-products/baketool/

    You should be able to bake entire scenes, I'm not sure if that is what you are saying you have difficulty uv unwrapping your objects. Never had much luck with the texture atlas plugin though.

    My advice, don't wait for lightmapping to work practically in unity, you might be years away. Use something else.
     
  19. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    That's a bad idea. There are few nutcases in UE4 community who are fanatical about this workflow, but the thing is it doesn't work. You should be placing objects within level editor in UNity, lightmapping tool then should pick them up. Do it the other way around and you'll waste a lot of time reimporting the scene every time you want to move an object for gameplay purposes.

    I think you don't get it. You should be able to hook up blender for lightmapping purposes only while doing design in unity. That will require a bit of work, but most likely can be done. Now, if you don't want to bother with that, it is another story.
     
    Pharaoh_ likes this.
  20. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I'm afraid I disagree, it is much easier to plan your entire scene outside of unity, bake then bring the scene in, I'm certainly wasting more time positioning objects inside unity but this is just my opinion, you can of course tweak the dynamic objects position within unity but this should be minimal.
     
    Last edited: Jan 2, 2016
    I_Am_DreReid likes this.
  21. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    You don't make terrains in Blender, neither trees placement and grass, so you could not place your houses and make your level in Blender.

    Blender baking times can be long, this is not a real time solution.
     
    Last edited: Jan 2, 2016
  22. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Clearly, you are unfamiliar with blender and it's capabilities, let's leave it at that. Since when do you 'don't make terrains, or trees or grass or full scenes in blender', come on now ;)

    You can always bake in blender internal as well, that is faster than cycles although you can bake with cycles GPU as well, which is still much faster than unity baking and more aesthetically pleasing IMO
     
  23. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    If it was a great way of making levels in Blender, a plugin would exist already, but that's not the case.
    I use Gaia to make terrains in Unity, and i place prefabs on top of the terrain in Unity, adding Blender in the pipe would make me loose lot of time.
     
  24. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    That's a only valid point, because you don't know the blender workflow so you will loose a lot of time learning blender, loosing a lot of time is only valid considering the toolchains you already know, just saying it is easier once you know what you're doing ;)
     
  25. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Blender internal uses outdated techniques, while Cycles is GPU accelerated and offer accelerated preview in the window. (Not realtime, but clsoe)

    That's not what it is about. You DON'T design game levels in modeling software.
    No matter how powerful that software is.

    Seriously, though, I keep remembering this thread every time you say something like that.
     
    theANMATOR2b likes this.
  26. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Doesn't matter blender internal will be faster as it doesn't have to process unbiased real-time lighting and illumination, but I do agree cycles is much better than blender internal, especially if you leverage the GPU, and the cgcookie plugin.

    This is your opinion, and I'm saying you can design game levels in modeling software, parts of models or entire scenes. I like doing entire scenes in blender and dragging them in, then adding physics colliders and lighting etc, I find this is much faster than manually positioning things inside unity. This works well, especially if you are baking the entire scene in cycles then bringing it into unity.
     
    Last edited: Jan 2, 2016
  27. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    That's not "my opinion".
    The common practice is to graybox the level in the editor, test the gameplay, THEN add details in modeling software once editing is done. You'll also want to keep modular design adjustable from within editor, good luck doing that in a scene that has been imported as a single file.

    ....

    Why the **** do I even bother wasting time in threads like this.
     
    theANMATOR2b likes this.
  28. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Ugh this is getting off topic...When you import a single file, blend scene the objects within the scene can be isolated and positioned accordingly. It is not set in stone, but if you work this way you are minimizing your amount of faffing about in unity which is tedious to work inside.
     
  29. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Try dragging one of the children into prefab.
    Try positionining objects in unity, then modifying blend scene, then reimporting it.
    Last time I checked this caused issues.

    You reaaally don't want this kind of approach for anything serious.

    And if you really wanna make your levels in blender, then you'd need custom export tool that handles references between Alt+D'd objects properly.
     
    theANMATOR2b likes this.
  30. Gonzilla2013

    Gonzilla2013

    Joined:
    Jan 23, 2014
    Posts:
    3
    Do you really know what lightmapping is using Unreal Engine actually? how I can see, Unity is not going to left aside Enlighten, so we´ll need to migrate to other game engine, sadly...
     
  31. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Or you can use real time GI coming solutions for Unity.
     
    Last edited: Feb 1, 2016
  32. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    From the lasted UE4 release notes :
    "We’ve integrated Intel's Embree ray tracing library into Lightmass and we got a huge lighting build speedup from it, as the majority of lighting build time goes toward tracing rays to figure out how light is bouncing."

    I tested it and it is a success after i tested it. I could bake a basic simple scene in 10 seconds while it is stiil too long and takes 5 minutes or lot more in Unity.
     
  33. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Let me guess, you created a 5x5 km terrain with a spectacularly high resolution? :D
    Actually I don't even know, does the terrain size have any impact on baking lightmaps or is it only affected by the lightmap resolution itself?
     
  34. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Two simple big cubes as ground and some simple objects on top of them for both Unity and UE4 test.
    Lightmass is really faster and improved with lats release, try yourself and make the comparison yourself.
    Unity will have to adress the issue at some point.
     
  35. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    As far as static baked lightmaps go, lightmass is much, much better than enlighten.
     
    IgorAherne and zenGarden like this.
  36. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I agree and UE4 mixed mode just works out of the box. Unity will have progrees to make about that and to reduce greatly the ligtmapping time because it is just too long on simple scenes without terrain.
     
  37. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Having a hard time myself, but couple of things that might significantly improve performance (windows 10 machine):

    Disclamer - do at your own risk, because this will expose your computer like a baby to a tiger.
    Also, I am a nabster in this, so I just disabled all sh!t for good.


    The following things can slow down your pc, so disable them:

    1) disable UAC via Regeddit
    here is how you disable UAC on Windows 10:

    Windows start button -> type "run" -> type Regeddit -> navigate to folder -> select file & change it.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

    and change the value EnableLUA to 0.


    2) In Windows Defender, disable: virus & threat protection (Real-time, cloud-based, automatic sample submission, etc). Turn off firewall for the networks - in "Firewall & network protection".
    If you have any other anti-virus, disable it as well

    3) Add unity.exe program as exception as two rules - outgoing and inbound, make sure the rules allow all connection.
    Search for youtube tutorials if you don't know how to do it

    4) restart your PC & verify that windows defender hasn't tried to turn-on the Realtime protection


    5) get yourself PCI M2 storage instead of HDD or SSD (at least 250 Gigs). They are 3 times faster than an SSD, because their communication is similar to your graphic card. If your motherboard doesn't have the slot, use a PCI adapter for that PCI M2 drive.

    6) re-install your operating system onto that new drive.
    6.5) if OS refuses to be installed onto that new drive, update your Bios & sata drivers for motherboard, then try again.

    7) install unity there as well and store your unity-project there too

    8) in unity, go Edit->Preferences and ensure the GI Cache is on that fast hard drive too. Ensure it has no compression & that it's large enough (at least 80Gb)
     
    Last edited: Sep 3, 2017
  38. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Steps 1,2,3:

    None of that will actually affect anyone's performance. Are you following instructions from script kiddies to compromise your computer? because that would work.

    Otherwise if you want to make a major difference, check the docs, plenty of decent advice on managing island size, keeping textures tight. Not everything needs to contribute or even be lightmapped.

    Basically it's not well understood by most people, and I guess up to a point it's unity's responsibility.
     
    theANMATOR2b likes this.
  39. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Keeping islands equal is correct and crucial. After all, if resolutions vary on surfaces, this will kill the performance.

    I did check the checkers on objects in the Shadowmask mode, and they are perfectly equal
    Still for me there is a definite difference between Macbook Pro & stationary PC. Macbook takes 3 hours to bake, but the stronger machine 48 hours

    disabling the settings mentioned above sped up the PC which completes in 30 minutes
     
  40. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    What? No. You have to balance it so huge or farawary areas don't hog all the clusters, so it's pretty important you use different resolutions. Actually I'm not even sure what you even mean by equal.
    If changing the settings you mentioned made enlighten bake 96 times faster for you, there was (and probably still is) something wrong with your computer that isn't those settings.

    Edit: Also, just noticed, this was a necro from 1 1/2 years ago and the information posted wasn't that relevant. Maybe this should be locked? If we want to discuss how to get better and faster results out of enlighten, maybe we should have a new thread that has more current information.
     
  41. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    You are correct, the uv islands should take up reasonable resolution where appropriate. A wall that's never visible can have 4 times less texes than what's up close to the camera. That's relatively easily set-up via script that changes "scale in lightmap" parameter on required mesh renderers, to speed up the "by-hand" process

    I am just thinking about my project, where every single entity will eventually be visible on screen, at equal distance, so I automatically went "equal in resolution", but the above explanations is of course correct
     
    Last edited: Sep 4, 2017
  42. RZ_Studios

    RZ_Studios

    Joined:
    Dec 2, 2016
    Posts:
    1
    Hello everyone,

    Ok so I believe I found the solution as it is 2018 and I am using Unity 2018.1 and Unity still has the same issue. To fix this I had to do these following steps,

    1. Grab all your items from your scene by click “ctrl A” for Windows users and “command A” for Mac users. Now you either can right click on a certain object and click copy or use the copy command.

    2. Create a new scene and save it as something that will let you know the difference from the two scenes. For example mine was “Test Mapping ...”

    3. Right click on your hierarchy and go to paste or use the paste command keys. Once all items have been transported, tick off the check box for “lightmap static”

    4. From there select a few items and put them to static. Then go and bake and eventually you’ll find the thing that was creating your issues.

    This took me 20-30 min to do so do mind it is a little time consuming.

    Sadly this is the only way as of now. I even tried to use Unity’s progressive instead of enlighten but I was always stuck at
    0/11 Create Geometry | 3 Jobs and I left my PC on for 8 hours. Unity really needs to step up its game. There introducing great features but if there is one thing I know is that these features don’t always work. Which I don’t understand. I think if they’re making something and planning on introducing something new they should make sure it fits everyone’s agenda. Because from how I see it, enlighten probably most likly only be working/cooperating with the smaller scenes.