Search Unity

Official Progressive CPU Lightmapper

Discussion in 'Global Illumination' started by Kuba, Feb 2, 2017.

  1. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I found problem in Lightmap Size and Resolution. In CG Offline Render we need to wait 24 hour to render a single image in some cases. If we increase resolution and Lightmap Size in unity, The quality will be same but needs 24 hour to bake in unity too.

    In my test:

    Lightmap Size : 2048
    Resolution : 100

    Memory used :27 gb during bake
    Time : 7-10 hour

    Also i have tested 4096 size and unity crashed because RAM limitation

    PC Spec :
    4790K
    32GB DDR 3 Memory
    960 GTX
    Unity_Compare.jpg Unity_Compare21.jpg

    Update:
    Baked again in low res
    Resolution : 14
    Size 1024
    Bake time ~30 min


    l3.jpg
     
    Last edited: Apr 24, 2017
    buttmatrix likes this.
  2. JuanMaldonado

    JuanMaldonado

    Joined:
    Oct 12, 2012
    Posts:
    30
    Hi guys, this is driving me mad. I've tried everything, please advise.
    I'm using the progressive lightmapper and it looks quite promising except for the massive black squares I keep getting on the lightmaps. :mad:


    This is my checklist so far without any progress:
    • Mesh with Generate LightmapUVs checked on.
    • Lightmap parameters with Backface tolerance to 0.
    • Cleaned Cache. And set maximun size to 20GB.
    • Exported to a new clean project.
    • Pretty much tried every parameter in the Lighting/Scene tab.
    • Changed the reflection probes bounding box size inside and outside the mesh.
    • Lightmaps with Enlighten work just fine, but the result isn't that good.
    Here are more images showing my setup.
    01_BlackSquares_02.jpg 02_Lightmap.jpg 03_LightmapParameters.jpg 04_MeshImportSettings.jpg 05_LightingSetup.jpg
     
  3. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @JuanMaldonado
    1. Did you try unchecking "Compress Lightmaps"?
    2. Letting Unity generate lightmap UVs isn't always a good idea, especially if you have less than desirable topology
     
  4. JuanMaldonado

    JuanMaldonado

    Joined:
    Oct 12, 2012
    Posts:
    30
    1. Just rebaked with "Compress Lightmaps" unchecked and the issue maintains. The black squares change randomly on every bake. This is the result from the new bake.
      CompressLightmaps_OFF.jpg
    2. Creating custom UVs for me right now is not an option. Besides this problem does not appear when I use Enlighten, so there must be some glitch with the Progressive Lightmapper or I'm doing something wrong.
     
    Last edited: Apr 25, 2017
  5. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Probably is, but just out of curiosity, have you tried baking with PLM without letting Unity generate lightmap UVs? I believe Unity will fallback to UV1 if you do, which may produce different results. Also, maybe try assigning different models to separate baked tags(?)

    These are only suggestions, @Jesper-Mortensen is definitely better equipped to answer these types of questions.

    EDIT: I noticed your AO ray distance is extremely small, is that having an effect?
     
    Last edited: Apr 25, 2017
  6. JuanMaldonado

    JuanMaldonado

    Joined:
    Oct 12, 2012
    Posts:
    30
    In Unity, Generating Lightmap UVs when importirng a mesh without custom UVs is like the first rule of lightmapping.
    This is not an option for me since I'm not creating UVs (unwrap) in the 3d software.

    Just FYI, the result without Generate Lightmaps UVs would be something like this:
    NoUVs.jpg

    EDIT: @buttmatrix Nope, the AO max distance doesn't seem to affect the result.
    AOtry.jpg
     
    Last edited: Apr 26, 2017
  7. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Yeah, this likely has nothing to do with UVs since Enlighten is using exactly the same generated UVs and has no artifacts like these.
     
  8. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Witnessing black spots as well.... Seems to be affected systematically by filter radius, at least.

    EDIT: The issue seems to be related to area lights, specifically. I have not reproduced the error with point or directional lights.

    1.PNG 2.PNG 3.PNG
     
    Last edited: Apr 26, 2017
  9. BORODA

    BORODA

    Joined:
    Mar 19, 2013
    Posts:
    11
    Thanks for reply.
    Also, is there a solution for randomly appearing transparent blocks in directional lightmap image? Every time I have a finished bake there's always 2-5 of these blocks.

    And I have to correct them manually in image editing software (yay, manually editing lightmaps).
    And they look like white blocks on the actual surfaces inside the editor.
    They appear randomly at every rebake, looks like some kind of crash during lightmapping.
    And yes, I have backface tolerance already set to 0.
     
  10. thefranke

    thefranke

    Unity Technologies

    Joined:
    Jun 20, 2015
    Posts:
    153
    Which one of the three filter radii actually influences the size of the spots? What happens if you set filtering to None?
     
  11. JuanMaldonado

    JuanMaldonado

    Joined:
    Oct 12, 2012
    Posts:
    30
    Looks like the problem is with the area lights. Decreasing the filter radius does reduce the spots size but they still appear.
    Here area some tests:

    1. Using Area lights. Filtering radius = 0
    Filter=0_AreaLights.jpg

    2. Using Area lights. Filtering = none
    Filter=None_Arealights.jpg

    3. Using Point lights. Filtering radius = default
    Firlter=Default_PointLights.jpg
     
  12. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    If you'd like, I can post some screenshots for different permutations of the settings later.

    EDIT: I'm not sure what to say at this point. I was unable to reproduce the artifacts in 5.6.0f3 (see attached) regardless, of filtering, resolution, AO, directional mode, etc. I will try again this evening in 2017.1.0b1

    shell_Test.PNG
     
    Last edited: Apr 27, 2017
  13. BORODA

    BORODA

    Joined:
    Mar 19, 2013
    Posts:
    11
    My issue, holes in directional lightmap that look white on surfaces, is also an area light problem. So it appears that we are having the same exact problem, just different symptoms.
    My solution for now is to replace area lights with planes containing emission - this solves the issue for me.
     
    JuanMaldonado likes this.
  14. JuanMaldonado

    JuanMaldonado

    Joined:
    Oct 12, 2012
    Posts:
    30
    @BORODA Nice workaround. Baking is faster with emissive planes than using area lights and quality is similar, not as good but it works for now.
    Here are some screenshots for comparison:
    Filter=0_AreaLights.jpg EmissivePlanes.jpg EmissivePlanes_Setup.jpg
     
    Last edited: Apr 27, 2017
  15. BORODA

    BORODA

    Joined:
    Mar 19, 2013
    Posts:
    11
    Yes, quality is degraded, but at least it doesn't generate all this garbage. For my cases, where the area/emissive lights only affect a relatively small area this workaround works much better.
    At least I can use the actual ray-tracer instead of cranking up resolution of enlighten up to the sky to get small details in light visible.
     
  16. BORODA

    BORODA

    Joined:
    Mar 19, 2013
    Posts:
    11
    So p3 doesn't contain any fixes for progressive? Any info when this will land?
     
  17. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    This problem occur around double sided faces:
    3.jpg
     
    Last edited: Apr 28, 2017
  18. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    That patch is being lit by an area light?
     
  19. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    No. An directional light for outdoor scene
     
  20. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey All,
    When baking small scenes the progressive baker works well, however when I attempt to bake larger scenes (even with very small parameters) the editor crashes with no memory issue. Also, if I use enlighten to bake the larger scene it completes after about 3 hrs but the shadows do no render on some objects even though I can see them in the shadow mask view.

    Shadow mask view:
    upload_2017-5-1_11-25-39.png

    Shaded view:
    upload_2017-5-1_11-26-11.png

    Everything is the same color in shaded view.. Any idea why?
    Cheers,
    Colton
     
  21. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Isn't that area already covered by a baked shadow? In that case, shadow mask never has an effect, which is a correct behavior for it.
     
  22. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    But this tower is all the same color (360 degress around) as the in the screen shot, should it not be lighter where the shadow mask shows light blue?

    EDIT : I have attached a screen shot that shows where to camera is in relation to the tower.
     

    Attached Files:

  23. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Ah, alright, the background area below gave the impression that the color of the tower was influenced by a baked shadow.
     
  24. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Yea unfortunately the castle wall below is also suffering from the same issue, shadow mask shows baked shadows but shaded does not..
     
  25. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I finally got a good result with these settings to reduce less noise:
    Direct samples: 1000
    Indirect : 10.000
    Resolution : 14
    Backface Tolerance : 0

    All lighting with emissive materials

    Linear color space + natural color grading

    6-7 hour bake time (Same as cg render used Rove3D)

    the below screenshot is after 1 hour baking Compare__LL.jpg
     
    Gametyme, buttmatrix and Detniess like this.
  26. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Very nice, well done! I'm impressed you were able to achieve that level of clarity with emissives only. What are your AO settings?

    Would love to see screens from the full bake
     
    Last edited: May 5, 2017
  27. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874

    Thank you. I will upload more comparison screen shots and demo exe and videos with my lighting setup .

    I found Linear color space a lot better for lighting . It's used in UE4 and offline renderers. I didn't know that.


    Bake Time: 5.27
    Res: 14, Sample count : Direct-1000 Indirect-10.000 AO: is off. AO is not necessary for Progressive and All path tracer renderers
    Linear 2017-05-05 12-59-06-69.jpg Linear 2017-05-05 12-59-19-63.jpg Linear 2017-05-05 12-59-26-08.jpg Linear 2017-05-05 12-59-30-93.jpg Linear 2017-05-05 12-59-37-49.jpg http://imgur.com/a/K8ZBO
     
    Last edited: May 5, 2017
  28. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @aliyeredon2 Could you elaborate on what you mean by, "AO is not necessary for path tracer renderers"? It may not be necessary, but it may be desirable in some cases, hence it's inclusion.

    Also, can anyone describe the tradeoff between direct samples and indirect samples? I understand fundamentally what is happening, but I noticed PLM default settings for direct samples is an order of magnitude (or more) lower than indirect samples. What is the logic behind this configuration?
     
  29. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    There is no trade off.

    Direct samples are used for the soft shadows from baked lights (spots, points, directionals and area lights) and indirect samples for everything else.

    You only need to crank up the direct samples if you have really soft shadows.
     
    UnityLighting and buttmatrix like this.
  30. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874

    About AO:
    In my experiences in VRay and other offline renderers and PLM, AO automatically caused in corners by indirect shadows. So it's not necessary to add additional AO to corners by settings.
    Also AO needs to bake in High resolutions to get good results in PLM.
    For example in this screenshot i didn't used AO at all:


    So you can see AO applied by indirect shadows automatically
    My goal was "Natural Looking" for interior scenes. You can use AO for games to looks more beautiful similar to Far Cry games thats used high amount of AO in game

    About direct samples, No you can use default settings. I have just used 1000 to ensure about final quality.
     
  31. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
  32. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Literally never seen baked GI this smooth in Unity, until now.
    Screenshot (97).png Screenshot (98).png Screenshot (100).png Screenshot (101).png
     
    Last edited: May 7, 2017
  33. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
  34. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Before I was using Enlighten :). The settings are similar to yours, but with maxed out texel resolution.
     
  35. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Without bakedAO?
     
  36. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Actually, in those screenshots I have a Baked AO of .001, but since your earlier comment I have turned it off and the difference is negligible.
     
    Last edited: May 7, 2017
    UnityLighting likes this.
  37. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys... does anyone have issues with the editor suddenly crashing when the PL is launched. I am on Unity 5.6 and even with a simple scene like a plane, the editor will just crash once it hits the baking stage. There is no crash log, no warning, it just crashes and I am forced to exit. Is there a way to generate a crash log in Unity?
     
  38. jStinson

    jStinson

    Joined:
    May 9, 2017
    Posts:
    21
    I just started experiencing crashes on a (now relatively large) scene. It would prepare the bake, then crash the editor once the bake started. I have a bake going now after turning off 'Prioritize View'. Not sure if this will help you KRGraphics, but something to try.
     
  39. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey @jStinson,
    Having the same issue as you with crashing in fairly large scenes with an out of memory error. Unfortunately turning off prioritize view did not help. Please post if you find a solution to this!
    Cheers,
    Colton
     
  40. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Open task manager and check Ram used when preparing to bake. For large scene you need more Ram. For example sometimes my scene with 32gb memory crashed with high resolution (High means 40 for my case )
     
  41. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey @aliyeredon2
    Yea I know what the error means and unfortunately we are currently running bakes on a computer that only has 16gbs of ram. I was just hoping there was a quick fix instead of purchasing more ram.
    Cheers,
    Colton
     
  42. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Baked lightmapping needs specular directional, without this the results area really bad in some scenes that I made in the past. I tried the "reflection probe" solution and.... the solution is worst when I compare both system. The metals lost all the highlights.
     
  43. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    send some screen shots from both solution. I think Reflection Probes is good enough because some of scenes has no direct light.
     
  44. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    I don't think so, I have some scenes without specular you lost all the metal details, the metal are like wood.
     
  45. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Send me screenshot
     
  46. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Are you a Unity developer?
     
  47. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    This thread may be more appropriate for your question.
     
  48. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    No. I just want to see what is problem
     
  49. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Last edited: May 10, 2017
  50. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Ok Guys, after some test you can improve the specular problem BAKING THE LIGHTS in reflection probes. Actually the lights disappear from reflection probes (user don't have any option to change this, or I didn't find it) and without lights in render probes, how could we see specular in reflections???
     
    Last edited: May 10, 2017