Search Unity

Official Progressive CPU Lightmapper

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

  1. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Mixed lighting is probably a better option in terms of visual fidelity, to say nothing of performance
     
  2. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    If you want environment reflections as specular on your surface, you need to use an TGA or PSD texture file with specular on alpha channel.
    Here is reflections on Container and ground surface using Reflection Probe:

    photo_2017-05-10_22-37-41.jpg
     
  3. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    I really don't understand the logic in that, probably because don't have any logic and I don't talk about external enviroment.
     
    UnityLighting likes this.
  4. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    How do you bake this as a part of an automated build pipeline?
     
  5. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Do you ask me?
     
  6. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I am asking anybody who knows:) If you have the secrets then divluge them:)
     
  7. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Actually I'm adding sphere/planes to all lights, spheres with emissive, that don't bake the emissive and you cannot see in rendertime.
     
    AcidArrow likes this.
  8. jStinson

    jStinson

    Joined:
    May 9, 2017
    Posts:
    21
    I was recently able to render a high resolution light map for my scene. The fidelity of the lighting overall was great, but the higher resolution introduced some odd artifacts in the light maps. Basically there were some full bright squares on areas of objects that should be dark (UV related perhaps?). Here's a small snip of what I'm talking about. Apologies for the low resolution and bloom, but I've since rebaked the scene, at which point the artifact doesn't show up.

    upload_2017-5-12_16-5-59.png

    Sorry if this isn't specific to the progressive baker, but I'd appreciate a nudge in the right direction to investigate the issue. Thanks!
     
  9. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Based on what you've described, it's almost certainly a UV issue. Unless you are using area lights which are known to produce artifacts with PLM(?)
     
    jStinson likes this.
  10. BORODA

    BORODA

    Joined:
    Mar 19, 2013
    Posts:
    11
    Actually, I have the same issues without having any area ligths in scene. Area lights just make the problem worth. But this issues are pretty easy to correct. After the final bake I open up directional lightmap and fix all the empty squares on the textures. It's not that bad considering how good the overall light quality is in comparison to enlighten that took 40 hours to bake and insane resolution to get a results that remotely look like ones I get from 3-4 hours of baking with PLM.
     
    jStinson and buttmatrix like this.
  11. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Are there any known issues with the progressive lightmapping when making a standalone build?

    I was doing some experimenting using the old Unity Labs demo. I'm aware it's no longer officially supported, but at least as of 5.6 it inports without any errors and the lighting builds quickly and beautifully in the editor so it's a good stand-in for any other complex 5.x environment. I let the progressive lightmapper completely finish before going to generate a build.

    When it comes time to make a standalone build however it seems to get stuck, looking like it's starting an enlighten build from scratch? Is this expected behaviour?
     
  12. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    out of curiosity, when you generate the standalone build, is 'autogenerate lighting' enabled, or not?
     
  13. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    How can i change PLM settings in my script?

    for example i need followings:

    LightmapEditorSettings.PathTracerFilter.ATrous

    and Indirect Sample coints
     
  14. jStinson

    jStinson

    Joined:
    May 9, 2017
    Posts:
    21
    Thanks, I thought that might be the case. Is manually creating a light map UV set the best solution or is it possible that the auto UV settings in Unity are causing the problem?

    Cheers, this fixes the problem, but is a bit tedious and would be great to avoid it if possible.

    //Edit: I found a pretty decent workflow for removing the artifacts from the directional maps. It's not perfect, but it's faster than editing the directional maps by hand.

    1) Open the _dir map in Photoshop
    2) Duplicate the layer
    3) Run the xNormal dilation filter (set pixel radius large enough to resolve gaps in the _dir map)
    4) Control click the original layer to load it as a selection
    5) Expand the selection with the same pixel amount used in the dilation filter
    6) Use the selection to create a layer mask on the dilated layer
    7) Hide the original layer and save the PNG
     
    Last edited: May 15, 2017
  15. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I obviously can't be sure exactly what issue you are facing, but many issues in lightmapping come from bad normals, bad geo, bad UVs, etc. If you let Unity generate lightmap UVs, you lose control over the placement of seams, but you probably won't face any issues with UVs either. There is a known issue regarding negatively scaled meshes (mirrored objects), but this can be addressed by setting backface tolerance to zero in the lightmap parameters. I personally have not encountered many issues related to PLM itself.
     
    jStinson likes this.
  16. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I have tested both Auto Lightmap UV Generation and manual unwrapping. The result is same. If you had lightmap uv problems, just increase Lightmap Scale in mesh renderer:
     
    Gametyme likes this.
  17. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Any ETA on mixed mode lighting being supported by the Progressive Lightmapper?
     
  18. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    I have a question though, when i baked my maps using progressive lightmapper, & when i reload my scene after restarting my comp, the lightmaps disappeared. Do i need to baked using enlighten after baking with progressive?
     
  19. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    I found the difference between rendering with PLM and Offline CG Render:
    PLM is an lightmap baker and lighting is calculated in lightmap texture size and resolution. So by increasing model's poly counts,the bake time will not change

    CG Offline render is rendered in poly counts. When you want to use highpoly model, you should wait a long time to complete render. You cannot change easily lightmap resolution and reduce rendering time in this case.
    Also resolution will be maximum in this case and will depend on triangle counts or pixel counts (i'm not sure)

    The Solution:
    1. Extract combined floor geometry from house model (Detaching in max, Extract in maya)
    2. select floor mesh and increase lightmap scale to maximum
    3.(optional) increase lightmap size
    note: smaller parts(surfaces) has higher lightmap resolution, combined surfaces has lower lightmap resolution)
    Webp.net-gifmaker (1).gif
    View attachment 231289
     
    Last edited: May 18, 2017
  20. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Hey, I'm using Unity5.6.1p1 and the progressive lightmapper is not working correctly.

    I'm not sure what causes this issue. It never happened before.
     
  21. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Clean GI Cache and restart unity
     
  22. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Thanks for the suggestion, but that didn't work
     
  23. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Try a new scene
    I already had this problem in my a big city scene. But after few minutes its solved during bake time as i remember.
     
  24. gevarre

    gevarre

    Joined:
    Jan 19, 2009
    Posts:
    132
    Tiling Not Working With Transparency
    With the progressive lightmapper, besides already listed problems with transpanrency, I've discovered that it's ignoring the tile settings of the shaders. The images are of a catwalk with transparency for the grating against a plane. The shader is just the standard shader. Here's with the tiling set to 1x1:
    TransLightmap_NoTile.jpg

    And here's with tiling set to 3x3 and then re-rendering:
    TransLightmap_Tiled.jpg

    Notice there is no difference.
    Oh, and the bug with black areas behind transparent objects is still there, as described in page 2 of this thread. I found that setting "Bounces" to none in the Lightmapping Settings section gets rid of them, which is why they aren't seen here.
     
    buttmatrix likes this.
  25. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Thanks, that kinda solved the issue. I was testing the lightmap so it wasn't a big deal, but I'm getting worried that it might happen again on my main project.
     
  26. thefranke

    thefranke

    Unity Technologies

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

    we are aware of that issue and there is already a fix lined up waiting for integration.

    Cheers
     
    buttmatrix likes this.
  27. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Hey, I found out what causes the issue. When there is a terrain in my scene, Progressive Lightmapper doesn't work properly on Unity5.6.1. Is this a known issue?
     
  28. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Same for me. Fixed by adding a simple cube into scene
     
  29. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    PLM is still unusable in outdoor scene
    please fix this issue
     

    Attached Files:

  30. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874

    I found the issue.
    Unity always used Very-Low preset for terrain in lighting settings. You should create manually an Lightmap Parameters with 0 Backface Tolerance and set it manually to terrain in Lighting settings. Terrain does not uses scene lightmap parameters automatically.

    Also to fix black areas on tree leafs, you can increase Pushoff in lightmap parameters
     

    Attached Files:

    Gametyme and buttmatrix like this.
  31. jldevoy

    jldevoy

    Joined:
    May 2, 2014
    Posts:
    33
    Can unity add a continue button to the PLM, so if my 4 hour bake was almost there i can add another hour to it instead of restarting a 5 hour bake. I know i could just start a massively long bake and stop it when it's ready but that would affect the prioritize view option being used to judge if the bake is good enough...i zoom in to look at a problem area at start of baking.
     
    UnityLighting likes this.
  32. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Fixed double sided geometry baking in 2017.1b9:
    Untitled21.jpg Untitled34.jpg
    Added geometry transparent baking (window glasses that are made using cubes):
    Untitled.jpg
     
    Last edited: Jun 11, 2017
    buttmatrix likes this.
  33. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    to get cleaner fake indirect shadows, you can use low intensity spot lights inside windows and indirect light sources:
    similar to ue demos
    Also noise reduced to minimum in this case. for example 500 sample counts is now comparable to 3000 sample counts



    1.jpg 21.jpg 1.jpg 21.jpg
     
    Last edited: Jun 14, 2017
    NGC6543, Adam-Bailey and buttmatrix like this.
  34. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Fake indirect shadows with higher quality than correct way :
    Cleaner bake with less noise hnet.com-gifmaker (2).gif 3.jpg
     
    Last edited: Jun 15, 2017
  35. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    I probably found an issue with PLM,
    in large scenes with lots of lights, it starts to ignore some of them completely. The worst part about this behavior is, that it seems to pick the ignored lights at random.
    It happens when having more than a few (> 20) lights in a scene.
    upload_2017-6-16_15-19-4.png

    You can clearly see it in the screenshot above, that although all spotlights have the same settings (and are active) only few of them are having visible cones on the faces underneath them.

    The scene is nothing all too strange. It's a warehouse (aprox 300 x 100 units) with one directional light as the sun, 7 (very large) area lights underneath the ceiling-window-areas to add some extra "indirect illumination" and then the ceiling lights (more than 50 of them), which consist of 2 spotlights each (to fake their non-spherical shape)

    It is baking rather fast (compared to enlighten) - takes about 45 minutes with the following settings:

    # direct samples: 32
    # indirect samples: 250
    lightmap resolution 15

    it results in 8 1024 lightmaps for the whole scene, which seems reasonable for me...

    I haven't tested it with 2017-beta, but i'd like to know, if there is some sort of limit in regards to number of active lights (which would kinda defeat the purpose of baking them beforehand...)
     
    buttmatrix likes this.
  36. jmitcheson

    jmitcheson

    Joined:
    Oct 21, 2016
    Posts:
    96
    I'm quite confused at the status of dynamic objects casting shadows onto static objects in "Subtractive" mode using the PLM (5.6.1)

    In the most simple of tests, this works fine until you change from Enlighten to PLM. Then it no longer works.

    However, there are no notes inside Unity or on the Google documents?!
     
    Exustus likes this.
  37. jmitcheson

    jmitcheson

    Joined:
    Oct 21, 2016
    Posts:
    96
    As a follow-up to my previous post above:

    I opened the exact same scene in 2017.1 and the PLM now works correctly with regards to dynamic objects casting shadows onto static objects.

    I can only assume this was a known bug in 5.6; I know bugs happen but it is a little frustrating to place a tooltip inside the lighting panel which says "Dynamic objects [...] cast shadows on static objects [...]" if it's not true. I can tolerate a bug, but not the in-application UI telling me complete falsehoods. I've spent hours trying to work out what I was doing wrong.
     
    Exustus likes this.
  38. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    ...or you could just read the info in 5.6, which states exactly this.
    Sorry, i don't want to offend you, but it's written right there even with a warning icon:

    upload_2017-6-19_10-0-45.png
     
  39. jmitcheson

    jmitcheson

    Joined:
    Oct 21, 2016
    Posts:
    96
    No offense taken. I can see that tooltip quite clearly, but there are 4 light modes listed.

    Baked Indirect
    Shadowmask
    Distance Shadowmask
    Subtractive

    The tooltip says that 'Shadowmask' and 'Distance Shadowmask are unsupported'.

    Am I to infer from this tooltip that the final light mode, subtractive, which is not mentioned in the tooltip, is also unsupported? o_O
     
    Exustus likes this.
  40. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    somewhat, because it only is gone, when you pick "baked indirect" and the preliminary documentation (https://docs.google.com/document/d/...Eyfmojn_JlCeoLN9Q/edit#heading=h.cxiwma8xnxjv) states also "Currently light modes are not supported, please be sure to set ‘Baked Indirect’ and do not use ‘Stationary’ lights. The support will come soon."

    As the whole feature (PLM) is clearly marked as Experimental and in further development, it's kinda to be expected, that certain things just won't work right now, no matter the tooltip.

    My aforementioned bug with PLM ignoring lights when baking is confirmed as a bug by now as well, by the way.

    Again, i'm sorry you spent hours on this, but it wouldn't have been necessary, i guess.
    I do agree, that the tooltip is kinda badly written, but at least it's there to begin with.
     
  41. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Same problem for me with 257 spot lights. Already worked fine but when i adding new lights... disabled randomly (chooses from all lights)
    Maybe those bulbs are burnt for more realistic behavior :eek:
     

    Attached Files:

    Last edited: Jun 21, 2017
  42. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    You can track the issue here https://fogbugz.unity3d.com/f/cases/922212/
     
  43. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    I reported the issue via bug reporting and got informed, that it is recognized as bug and forwarded to the developers. Let's hope, that there will be a fix for this soon. The linked case is not visible to me, because it asks for a login, which i don't have...
     
  44. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey, guys. Is anyone getting issues with sudden overexposed lighting when they are in play mode AFTER baking? I'm using the bake prefab lightmap script amd unfortunately when I play my scene, I'm suddenly seeing my entire scene glow

    IMG_20170625_103700_332.jpg

    And then
    IMG_20170625_103700_333.jpg

    This happens with Enlighten and the PLM.
     
  45. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    @KRGraphics Yes, we do here.
    Only happens with 5.6 though, on 5.5 it was working fine.
     
  46. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    So, to add to the Lightmapping woes... I filed a bug report for issues during play where my lightmaps would become overexposed and wash out everything.

    Case 924520 is my report
     
  47. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    The lightmaps disappear completely if you bake with the PL
     
  48. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Checked the bug you sent in but there is no repro project. Can you make a small reproducer for this issue?

    One thing to check is to disable reflection probes to remove that part of the lighting from the equation, can you just try that?
     
    KRGraphics likes this.
  49. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I will give that a shot. Though just now I opened the scene to disable reflection probes, and I just played the scene and the problem went away... I don't know how exactly, but I will keep the scene to do further testing. I also did a new project and it wasn't doing it. It might be something in my project
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    @Jesper-Mortensen I think I found the culprit in my project. If you set Direction Mode to Directional, the entire scene becomes bright as a Roman Candle.

    Non-Directional Mode During Play in Scene View

    Screenshot 2017-06-29 09.42.02.png

    Directional Mode During Gameplay (This happens EVERY TIME!)

    Screenshot 2017-06-29 09.44.21.png