Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Global Illumination Computation (Unity5) ongoing saga

Discussion in 'Global Illumination' started by radiantboy, Mar 4, 2015.

  1. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I'd just like to chime in that I imported my mesh at scale = .001, mesh compression = off, generate lightmap UVs = on, and the bake went very smoothly and produced quality lightmaps. Prior to this, I had spent about 16hrs - straight - wrestling with those BLACK BLOTCHES. Thanks for the tips!
     
    radiantboy likes this.
  2. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Is what your saying is that all models should be 1,1,1 scale in the transform section of the inspector? That is completely absurd if people are expected to do that. I've heard that the file scale should be 1, but nothing regarding a scale requirement in the transform section. I hope you are wrong. IF you continue to update the scale in the model you could continually have to re-position the model. Plus what happens if you have two instances of the same object, but want one to be smaller than the other, are we supposed to have multiple copies of the same model file (cubeSmall.blend, cubeLarge.blend, cubeMedium.blend....)? Could you elaborate more on your findings if you have time? Thanks.
     
    radiantboy likes this.
  3. sdmattos

    sdmattos

    Joined:
    Jan 11, 2015
    Posts:
    7
    What size was your atlas and did you use ambient occlusion? If so how much?
     
  4. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Right, I apologize for not including more detail:

    General GI
    Baked Resolution = 40 (trying a bake at 60 ATM)
    Bake Padding = 2
    Compressed = on
    Ambient Occlusion = 1
    Max Distance = 1
    Final Gather = off

    General GI
    Directional Mode = Directional
    Indirect Intensity = 1
    Bounce Boost = 1
    Default Parameters = Default
    Atlas Size = 2048

    BTW this tutorial is amazing
    http://sassybot.com/blog/lightmapping-in-unity-5/
     
    radiantboy likes this.
  5. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    page 2 of forum

    "Some updates from the legends at Unity..

    As for the scale issue mentioned by @Nubeh , this is from UnityQA "No the scaling of your obejcts is not an issue. In your case just make sure you tick "Generate Lightmap UVs" on the importer."

    Edit: As such, I don't expect the scale of the mesh is related to the artifacts, it's more likely related to the atlas size, whether lightmap UVs are selected in import settings, or mesh compression. I'm in the process of testing whether mesh compression might be the culprit, but there is a post on page 2 indicating that is unlikely.

    Edit: Whether Baked GI was compressed or not had no perceptible impact on the quality of the lightmap bake (surprisingly). My atlas size was set to 2048, no mesh compression.

    Edit: Mesh Compression on High caused some mesh components to disconnect at seams, but did not result in difference in the lightmap bake quality. However, I am getting strange artifacts with glass surfaces (looks like mesh is "burnt" where glass meets other surfaces).
     
    Last edited: Jul 12, 2015
    ArachnidAnimal likes this.
  6. sdmattos

    sdmattos

    Joined:
    Jan 11, 2015
    Posts:
    7
    Thanks for this. I'll have to try it when I get to my computer, or at least use this to go off of thanks again
     
  7. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I haven't been able to pull of a 4096 atlas bake, but if someone with a beefier GPU can (or has), I'd like to know if it is a noticeable improvement over 2048.
     
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,592
    Quick script for those wishing to make absolutely sure all their meshes have "generate lightmap UVs" ticked, put this in assets/editor/ and right click "reimport all". This will take a long time but then all meshes should have that ticked.
    Code (CSharp):
    1.  
    2. using UnityEditor;
    3. using UnityEngine;
    4. public class FBXUV_Set : AssetPostprocessor
    5. {
    6.  
    7.     public static int count;
    8.      public void OnPreprocessModel()
    9.      {
    10.         Debug.Log("OnPreprocessModel---------------set uvs on: "+count);
    11.          ModelImporter modelImporter = (ModelImporter) assetImporter;
    12.         if ( modelImporter.generateSecondaryUV)
    13.         {
    14.             Debug.Log("NO NEED TO generate UVs for "+modelImporter.assetPath);
    15.         }
    16.         else
    17.         {
    18.             Debug.Log("Explicitly setting generate UVs for "+modelImporter.assetPath);
    19.             modelImporter.generateSecondaryUV = true;
    20.             count++;
    21.         }
    22.        
    23.      }
    24. }
     
    ArachnidAnimal likes this.
  9. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Could we just use this for re-importing individual models, or do we have re-import everything? Thanks.

    Another way you could check it is just doing a search for all models. Then select all models in the window at once. Verify the "Generate UV" is selected. If one or more isnt, then the checkbox will not have the check mark.

    step1.png

    h

    step2.png

    all of the models i selected have "Generate UVs" marked.
     
  10. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,592
    For me as soon as I select more than say 10 unity says I cannot edit multiple objects for whatever reason, so I had to write this script, its STILL reimporting :) .. My project is very large..and very messy, so it seemed like this approach was best but yes there is wasted time only models should be reimported but I dont know if thats possible. Maybe I could have selected them all right clicked and only reimported them instead of all..
     
  11. anish_mathew

    anish_mathew

    Joined:
    Jul 16, 2015
    Posts:
    1
    After all the reading on this thread I just wish enlighten would just show us some visual progress on the baking solutions like 3ds max/vray does with their IR and Light caches; it helps tell you EXACTLY where it failed. Is it the mesh size, texture size, system config, render settings, etc. What should I fix? I've done pretty much everything mentioned in the thread from checking "generate lightmpa UV's" to "non directional" but it's not going anywhere. I'm trying to build an architectural scene that was running perfect till I brought in a second level to the building and nothing happens. I've checked the editor logs and error reports which brought me to this thread, but it doesn't look like Unity has the answers right now. The thing is, the file doesn't crash and just gets stuck at either 'light transport' or 'baking visibility' and it just stays there forever. So, OP, we will wait and see what happens. Right now, I have my scene rendering in 5 different, but identical machines (Dell T1700s) in 5 different settings, from very low to very high. Let's see what works and I'll report back. My last go is to start this entire process over again and set the build to auto and import my models one by one.
     
    Last edited: Jul 16, 2015
  12. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,592
    Managed a bake with the new unity, its not 5.2 yet not sure if the fix is in, my scene baked in record time, but results were very ugly with all my lights set to baked. I have moved them back to mixed and it looks fine again, not sure really how much cpu time it saves being mixed, but I cant have it ruining all my good work. I had figured baked would or should look almost as good as real time If not better.. anyway, the saga continues but im giving up again now for a while its just too much like hardwork. After my game stopped playing unity decided to go back to stage 10 of baking and as of now im still waiting, all I did was hit play. If it wasnt me sitting through the waiting it would be comical, perhaps something from the IT Crowd. Anyway it seems for now, either Ive done something wrong or baking is kinda ugly - many/most of my models looked terrible, so I will stick with what I have, its a huge drain no doubt having so many realtime lights, and again I do wonder what mixed really means.

    Good luck fellow bakers!
     
  13. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,592
    I tried to get rid of the bad effects from light mapping but some blocky shadows are now built into my models, how do I remove that? I cleared lightmaps, made it not lightmap static, even tried unticking generate light map uvs, only way I can get rid of it is to change so it doesnt receive shadows but I want it to receive my real time ones.
     
  14. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,592
    So im left with some weird shadows after clearing everything, can anyone explain why the main shadows on my character have gone really blocky? not even sure its GI related but they looked great before hand!.. Quality is set to fantastic etc.
     
  15. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    541
    @radiantboy Don't know how much you rely on your current Unity version, but you can test the 5.2.0 beta3 version here. I'm currently also fighting with the baked GI, getting mostly "Failed executing external process for 'Clustering' job." errors in the bake process. Don't know what it should tell me (except that it may not work?), but the bake process is going on.
     
  16. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    is it a realtime light? try switching it to soft shadows instead of hard shadows. Then reduce the shadow strength until the blockyness dissapears.
     
  17. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    449
    Edit: Ok, so I guess I just needed to generate the lightmap UVs on import and reduce the resolution under general GI. Not sure which provided the most benefit in reducing precompute time though. I'll update this post if I have more important. Definitely have to do at least one or the other though to reduce build time.
     
    Last edited: Jul 21, 2015
  18. Udit_N

    Udit_N

    Joined:
    Mar 9, 2015
    Posts:
    17
    Hi, I had an interior scene which I baked first and baking was completed successfully with good Global illumination and all, but I got artefacts on my walls so I thought of increasing the Baked Resolution so the blotchyness of the walls may disappear, but when I increase my baked resolution I started getting errors, I thought clearing GI cache might solve the issue but It did not. Here are two screenshots, one of the baked scene and other of the errors I got. Please help baked scene.jpg error2.jpg
     
  19. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Hi, that looks really suspicious.
    Could you please report a bug with this scene attached?
     
  20. Udit_N

    Udit_N

    Joined:
    Mar 9, 2015
    Posts:
    17
    As suggested above I tried baking with "Non-Directional" maps and also reduced Baked resolution and Ray count down to 256 but still light mapping is getting stuck at Final Gather with error message "'Final Gather' job failed with error code: 5 ('Failed reading Bake Direct Output System file.')." :( Attaching a screenshot herewith, Please Help. error3.jpg
     
  21. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    495
    same issue to me with Directional maps n ray count to 256... anyone got solution yet?
     
  22. essimoon2

    essimoon2

    Joined:
    Nov 13, 2013
    Posts:
    195
    We, too, have still problems with Final Gather. "Solved" it by just not using Final Gather for now but hope to get better performance and to get rid of the errors in the future.
     
    LaserWzzrd likes this.
  23. fraglimit

    fraglimit

    Joined:
    Jul 8, 2013
    Posts:
    2
    Hi, I'm having similar issues with baking lightmaps. I'm getting either "Failed executing external process for 'Baking Resources' job" or "'Baking resources' job failed with error code: 3".
    I have searched high and low; nobody seems to have a solution for this problem.
    Just bumping the thread, hoping against hope that someone has an answer...
     
  24. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  25. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    I have just received an error when baking (5.3.4p6 (64b), during the 'Bake Direct' step):

    'Bake Direct' job failed with error code: 5 ('Failed reading Bake Visibility Buffer file.')

    The issue results in an infinite loop which prevents the baking process from being completed. The issue seems to appear only in some (rare) situations. I could solve it somehow but without having a clue what was actually wrong.

    Someone also has posted an issue here already: https://issuetracker.unity3d.com/issues/lighting-bake-direct-job-failed-with-error-code-5
     
    Last edited: May 17, 2016
  26. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Hi,
    I'm hoping I can get my lighting issue fixed. I am running unity 5.3
    Unity hangs on job 12/16
    here are my settings:
    [/URL][/IMG]


    Any ideas would be helpful!
    --Joshua


    EDIT

    Never mind fixed.
    For anyone seeing this and might be having the same issue, Make sure most of your assets are close to 0,0,0 on the world grid .
    As mine were more than 14,000 away in some cases.
     
    Last edited: May 19, 2016
  27. fraglimit

    fraglimit

    Joined:
    Jul 8, 2013
    Posts:
    2
    I managed to find a solution (well, it works for me, at least). I find that if I: 1) clear baked data (you can access that from the "Build" button dropdown on the Lighting panel) and 2) clear the GI cache ( Edit -> Preferences -> GI Cache ) it manages to complete building GI and lightmaps without crashing. However, if you make any changes to your scene and try to re-bake it will crash, unless you take the aforementioned steps. Hope that someone finds this useful.
     
    radiantboy likes this.
  28. mephistonight

    mephistonight

    Joined:
    Dec 14, 2016
    Posts:
    75
    Did you receive bug reports about this? I'm having a similar final gather error but don't want to duplicate bug reports if you already have them.
     
  29. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  30. mephistonight

    mephistonight

    Joined:
    Dec 14, 2016
    Posts:
    75
    I've found the only way to solve my problems with lightmapping in 5.6 is to ensure the following two steps are followed as a basic:

    1. Ensure all UV charts are reduced to a reasonable compromise between quality and performance: absolutely no hints of red. Btw - the documentation on what constitutes a reasonable chart (including what colour means what in the chart scene view) really needs more detail. Badly.

    2. Turn off auto in both baking and realtime GI. I find turning off auto when the charts are all of a reasonable size removes virtually every kind of bug I've come across. I think a lot of the lightmapping issues are more to do with error handling and precise messaging / feedback than it is about the lightmapping itself. I.e if you're asking for too many calculations from Enlighten because you haven't optimised your scene then all kinds of different errors pop up during the baking, sometimes taking you down completely blind alleys when trying to track down the reason.
     
  31. mephistonight

    mephistonight

    Joined:
    Dec 14, 2016
    Posts:
    75
    If you look at the comments on the issue you linked to, I humbly submit that this bug isn't fixed. Or, rather, the various potential causes that produce the same error message haven't all been identified / fixed. I'll try and reduce the my scene to a reasonable size and submit a bug report but that's not always easy to do as pinning down exactly what's causing it isn't always easy.
     
  32. pnrichens

    pnrichens

    Joined:
    Jun 24, 2015
    Posts:
    2
    I'm using Unity 5.6.3p2 on Windows 10.
    I've been having a lot of trouble with Realtime GI not processing correctly.

    I created a new Project and installed the Lighting Optimisation Tutorial from Unity Essentials on the Asset Store.
    I opened Scenes/Article/LightingTutorialOptimal; which has been tuned for best performance by experts.

    The GI cache was in default location, 20GB, and clean.

    I opened the Lighting Window and hit Generate Lighting

    This resulted in thousands of Console Errors:
    Error creating external process 'C:/Program Files/Unity/Editor/Data/Tools64/JobProcess.exe' : The operation completed successfully.
    Error cleaning up external process: The handle is invalid.
    Failed executing external process for 'Clustering' job.

    the progress bar remained stuck at
    5/11 Clustering | 16 Jobs
     
  33. pnrichens

    pnrichens

    Joined:
    Jun 24, 2015
    Posts:
    2
    the problem was that
    C:/Program Files/Unity/Editor/Data/Tools64/JobProcess.exe
    was a corrupt zero length file
    reinstalling Unity fixed it.