Search Unity

Official Progressive CPU Lightmapper

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

  1. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    haha, of course..Im still stuck in 'enlighten' bake mode :)

    Nice one, thx
     
  2. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Little heads up:


    New demo teaser making good use of Progressive Lightmapper and the new 18.1 custom bake feature.
     
    danix, petersx, Vagabond_ and 4 others like this.
  3. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    That grass(!!!) This is outstanding work, truly breathtaking. Please can we get a breakdown of this project from someone, at least the artists names?
     
    Last edited: Jan 16, 2018
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    That was...

    Amazing!

    I'm guessing it's from the internal team led by Veselin Efremov, right? It looks like it. (please don't give spinoffs to Oats this time :p )
     
  5. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Some more detail here: https://unity3d.com/book-of-the-dead

    The breakdown will be made public at GDC in March so a little wait.
     
  6. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Megascans ftw
     
  7. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yeah. Although, some of it was scanned in-house and delit with the Unity delighting tool from the Labs team.
     
    Lars-Steenhoff likes this.
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    looks awesome!
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    @Jesper-Mortensen It looks fantastic. What was PLM eventually used for, baked shadows? It's just I see the light update so I assume it's a mixed mode lighting. How long did a typical PLM resolve in?
     
    Lars-Steenhoff likes this.
  10. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I really can not imagine a Lightmapping to be used in such scenario !
    Was it actually !?

    I guess it is only custom shaders and post processing may be !?

    P.S. or it is not a real time at all !?

    P.S. sorry, i missed the post where is says it shows a good use of the Progressive Lightmapper - so Congrats - it's looking so realistic !!!

    But is this actually a real time footage or it is pre-baked into a video !?
     
    Last edited: Jan 16, 2018
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm ignorant as to what this is :(
     
    buttmatrix likes this.
  12. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I really doubt this is a real time or the actual 3D area is too wide ! I wonder as well how is this achieved and what the "custom bake feature" is !
     
  13. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    I'm guessing it's this (from the beta release notes)
    (I have no idea how to use it though)
     
    Vagabond_ and hippocoder like this.
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Right yeah, I think I'll be having a scoop of that on my plate.
     
  15. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    You nailed it. It lets you precompute sky occlusion values in a dense grid that can be used to occlude realtime sky lighting for the trees and foliage. The direct lighting is computed in realtime and bounced lighting is baked down.
     
  16. Owers

    Owers

    Joined:
    Jul 7, 2012
    Posts:
    39
    I would like to share my concerns about the Progressive Lightmapper's shadowmasks, too. Something is going wrong somewhere in the baking process, and it's breaking things like soft shadows and the baked shadow radius setting.

    Here's a comparison between Enlighten and Progressive, both using default settings:
    enlighten_shadowmask.jpg progressive_shadowmask.jpg

    I hope a fix can be provided soon. I understand it's a preview feature and work still needs to be done on it, but the Progressive Lightmapper is already far superior to Enlighten's baking solution, and this shadowmask problem is the final barrier to overcome before we can use it in our projects.

    EDIT: Whoops! I tested the project in 2018.1 beta2 and Progressive Lightmapper shadowmakss work flawlessly! Thank you for your hard work. I hope this can be backported to Unity 2017.3 soon.
     
    Last edited: Jan 17, 2018
  17. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We fixed some of this stuff when we added lightmodes in 2017.3. Can you try and spin up your level in 2017.3 and see if the same happens? If it does we could use a small reproduceable.
     
  18. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yes, this is something I've been working on recently in 2018.2+ the emission and albedo texture resolution will be decoupled from the lightmap resolution and it will be possible to have low or no lightmap on the emitter and still a high res emission texture.

    I also means that if you have loads of instances using the same material it can share the texture, saving memory while baking.
     
    Reanimate_L and AcidArrow like this.
  19. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We are working on fixing in 2017.3 too. @Kuba is looking into it.
     
  20. PatrikD

    PatrikD

    Joined:
    Sep 29, 2016
    Posts:
    15
    I'm not sure why but I dont get this error anymore.
    Sorry, not really helping here but I'm glad the error is gone
     
  21. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Thank you for reporting this. I have been able to reproduce this issue. As you point out it seem to only happen with very low resolutions. I will examine it further and (hopefully) come up with a fix for it.
     
    Last edited: Jan 19, 2018
  22. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    My pleasure :) I love the progressive lightmapper so far, so the quicker issues get solved, the better ;) Are you also addressing the bugged seams in the new unwrapper version (some seams are created on smooth areas with low angles)?
     
  23. mfCleRIC

    mfCleRIC

    Joined:
    Jan 14, 2016
    Posts:
    7
    Hello!
    We are using 2017.3.0p2 and Progressive Lightmapper with shadowmasks.

    We baked light and got that shadowmask.
    Where can these strange red lines in shadowmask of terrains come from?
     

    Attached Files:

    Last edited: Jan 23, 2018
  24. buFFalo94

    buFFalo94

    Joined:
    Sep 14, 2015
    Posts:
    273
    any ETA??? since the last time you said that 5.6.5 has been released and 5.6.5p1 too but none of these versions support Mixed Lighting Mode with PLM
     
    JamesArndt likes this.
  25. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Could be invalid texels maybe, can you check the texel validity scene view visualization?
     
  26. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    so how's the GPU support coming along?
     
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, a quick question, is it possible to play around with the sky occlusion experimental API !
    If it eventually available in v2018.1 b5 !?

    Thanks !
     
    Last edited: Feb 9, 2018
    buttmatrix likes this.
  28. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    i think @robert was planning to create a sample repo for that one
     
  29. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    Hi.

    May be i I will find solution here. I want use mixed lighting - precomputed GI and Progressive lightmapper.

    If i bake only precomputed GI, my dynamic objects recived color from light probes:



    But if i bake precomputed GI with PLM i have bug: after first play - light probes gives color, after next - only grayscale.
    This is first enter to play mode:


    And second enter to play mode without rebake or any changes:



    Screen with very low resolution for reduced time bake, but with high value - nothing changes.

    I am reproduced this in 5.6, 2017.2, 2017.3.

    Why after second and other play, indirect color from lightprobes disapears?

    It is only using PLM, with Enlighten all ok.
     
  30. danix

    danix

    Joined:
    Nov 15, 2013
    Posts:
    29
    Hello,

    Unity 2017.3.1 Mixed Lighting, Progressive Lightmapper with Lighting Mode Shadowmask still ugly, not accurate and jagged.
    Is it possible to edit the shadowmask file outside Unity and reuse it ?

    Thanks!
     
    ArchVizPRO likes this.
  31. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    any news of that sky occlusion repo?
     
  32. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    you can open the image in photoshop or gimp and resave. (in photoshop you need to use 'layer mask > from transparency) for the image to show up.
     
    danix likes this.
  33. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    So can someone confirm the jagged shadows are still an issue? Also the filtering seems pretty bad, as you can see in the images, it basically wipes out the shadow lines..it feels like the lowest setting of 1, isnt small enough for lower resolution bakes.

    The first image shows the nasty jagged lines without any filtering, and the second with lowest filter setting. ( i can get a nicer result passing a non filtered image through photoshop)

    jagged_shadow_01.jpg jagged_shadow_02.jpg

    Also i have noticed that as the progressive map iterates, you can see the shadow line appearing, but it disappears in the second pass, as though the samples are being deleted due to some hidden noise threshold or something. (see next images)
    bake_01.jpg bake_02.jpg bake_03.jpg


    This is unity 2017.3.0p4, win 10 on a real beefy xeon machine.
     
  34. doublegumbo

    doublegumbo

    Joined:
    Oct 24, 2013
    Posts:
    53
    I've been working with the Progressive Lightmapper, but I've noticed something in the 2018.1.0b4 beta that I can't quite figure out. Unlike in previous versions of Unity, when I bake my lightmaps using the PLM, I get an additional piece of information in the "debug" area related to "Memory Usage":

    (scroll down to the bottom of the pic)



    How am I to interpret this? Is the lightmap data taking up 2.0MB or 210 MB? Or is it only taking up that amount of memory when it's calculating the lightmaps? What are some strategies for reducing this, or should I even concern myself with it? Is this related to this issue?

    thanks for your guidance on this~!

    =g
     
  35. Dee_Lucky

    Dee_Lucky

    Joined:
    Jun 26, 2015
    Posts:
    53
    Is the issue of "Progressive lightmapper supports a maximum of 10000 instances" is fixed in new beta?
     
  36. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yes it was lifted in 2018.1 (open beta is available).
     
  37. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @gumbomasta

    I know you already got your response but just for ambient awareness, I'll also state it here. Memory usage part displays the amount of RAM used by Progressive Lightmapper and the section where it says 2.0 MB is the size of your lightmaps. So by looking at memory usage, you can estimate how much memory you need for baking your scene. This is useful because the amount of memory used in Task Manager is usually incorrect and misleads the usage of Unity while baking. Our developers injected custom memory labels to correctly track the usage of lightmapper.

    Thanks
     
    buttmatrix likes this.
  38. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @adpok

    Have you tried creating a custom lightmap parameter and using supersampling? (Anti aliasing parameter) If not, maybe you can try increasing that value and see if it helps.

    Also I must admit - you're using really low values. Direct samples of 1, indirect samples of 50 and lightmap resolution of 10? I don't know the scale units of your objects but with default Unity primitives, those settings would only render a draft quality. I recommend using at least 16 direct samples, 64 indirect samples and maybe a resolution of 20-24 to achieve a decent quality with your shadows.

    Thanks
     
    buttmatrix likes this.
  39. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @Vagabond and @hippocoder

    As Jesper said, details will be shared during GDC, but until then I can spoil some settings they used.

    They have one mixed directional light in the scene and they're using `Baked Indirect` mode. So only indirect illumination is baked into lightmaps and light probes. Direct lighting is realtime, that's why they can rotate the sun and can still pull it off. They can afford that since they've an open environment so bounce lighting is not a vital part of their lighting setup.

    If I'm not wrong (could still be PCF), they used moment shadow maps that Robert shared in one of his tweets before: https://twitter.com/robertcupisz/status/831968917778227203 And this shadow type is already available in 2018.1 HDRenderPipeline but it's not exposed to users in a artist friendly way yet. It'll be though, before the final release. 2018.1 is still in beta cycle.

    And yeah, as you know occlusion probes also play a crucial role for their setup. By default, trees painted on terrain only use single light probe for being lit. This renders a flat shading on tree asset. Occlusion probes that come with custom bake allows more granularity. We should show how that can be used indeed, and I think we'll do that very soon so stay tuned.
     
    Vagabond_ and buttmatrix like this.
  40. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @mfCleRIC

    Can you share the reproducible project with us please? I'd like to investigate this one a bit more to help you. You can either report it through BugReporter and share the case ID here or send a DM to me with the project.

    Thanks
     
  41. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @Puttrik

    It would actually be nice to get a solid reproducible project for this issue. We also see it here and there but can't reliably reproduce and the behaviour doesn't seem consistent.

    To answer your question, you can safely ignore these errors as long as it doesn't affect your baking process
     
  42. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi thanks, will stay tuned for this... !

    However may i suggest something which will be very useful in PLM. Can we have some control over threads used by PLM or priority etc. because it is somehow hard to navigate through scene when it bakes ( when doing a lot of test baking you decide to copy or move some objects while PLM is working ). if we can have at least one thread available in for editor it would be great because it gets unresponsive very often !

    This is just an idea and you may have a better idea on how to free up some resources for flying around or do some edit while baking !

    Thanks !
     
  43. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Well going forward we think focusing our resources on GPU Lightmapper makes more sense. When baking is done on GPU, CPU will be free/available to do everything you mentioned. Nevertheless, point taken. Thanks for your input
     
    Lars-Steenhoff and buttmatrix like this.
  44. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Sure GPU lightmapper is the most anticipated thing here. However some users will have to rely on the CPU baker because of the current hardware they use being not high end - like in my case !

    Thanks again !
     
    kemalakay likes this.
  45. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    Hi, thanks for reply. Yeah the scene is pretty huge, basically the ground is around 220units big...and I'm constricted to a 4k map so for my scene anymore than 10 and it wont fit....I've just been told that the issue is a bug in this Unity 2017.3, however Unity 2018.1.0b8 has had a fix or improvement. I am increasing the samples to around 200 for final bake, however I dont know if im expected to push it higher for such a large surface, as the render times get silly if i do.

    Also the direct samples is only needed if you are using soft shadows and baked shadow angle, apparently..i dont know if thats in the docs, but would be good if it was.
     
    Last edited: Feb 26, 2018
  46. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    I'm playing with the experimental api stuff in beta 9 and I'm trying to see what I can do. I'm enjoying the amount of control. But.

    Is .innerConeAngle supposed to work? (on spots, obviously)

    I'm successfully setting up the delegate and I'm able to change around other stuff (the normal cone, switching falloff types, setting a different indirect color, etc), but innerConeAngle changes absolutely nothing it seems.
     
  47. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @AcidArrow

    Inner cone angle only exists for Enlighten, that's not used by Progressive Lightmapper so it won't work. And for ambient awareness, let's also share an example code with others :) Following code demonstrates how you can change direct and indirect lighting color, intensity value and falloff for baked lights via API.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Experimental.GlobalIllumination;
    5. using UnityEngine.SceneManagement;
    6.  
    7. [ExecuteInEditMode]
    8. public class ExtractFalloff : MonoBehaviour
    9. {
    10.     public void OnEnable()
    11.     {
    12.         Lightmapping.RequestLightsDelegate testDel = (Light[] requests, Unity.Collections.NativeArray<LightDataGI> lightsOutput) =>
    13.         {
    14.             UnityEngine.Color aColor = new Vector4(1F, 0, 0, 1);
    15.             float aFloat = 3.0f;
    16.  
    17.             DirectionalLight dLight = new DirectionalLight();
    18.             PointLight point = new PointLight();
    19.             SpotLight spot = new SpotLight();
    20.             RectangleLight rect = new RectangleLight();
    21.             LightDataGI ld = new LightDataGI();
    22.  
    23.             for (int i = 0; i < requests.Length; i++)
    24.             {
    25.                 Light l = requests[i];
    26.                 switch (l.type)
    27.                 {
    28.                     case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break;
    29.                     case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break;
    30.                     case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break;
    31.                     case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break;
    32.                     default: ld.InitNoBake(l.GetInstanceID()); break;
    33.                 }
    34.                 ld.color = ld.indirectColor = UnityEngine.Experimental.GlobalIllumination.LinearColor.Convert(aColor, aFloat);
    35.  
    36.                 ld.falloff = FalloffType.InverseSquared;
    37.                 lightsOutput[i] = ld;
    38.             }
    39.         };
    40.  
    41.         Lightmapping.SetDelegate(testDel);
    42.     }
    43.  
    44.  
    45.     void OnDisable()
    46.     {
    47.         Lightmapping.ResetDelegate();
    48.     }
    49. }
    50.  
    51.  
     
    Lars-Steenhoff and AcidArrow like this.
  48. mihakinova

    mihakinova

    Joined:
    Jan 6, 2015
    Posts:
    85
    So I'm having this issue with no idea on how to fix it properly.

    Baking my lighting with the Progressive Lightmapper produces these weird dark squares. The strange part is, the more that the lightmapper does it's thing, the more the "artifacts" become visible:

    c1.PNG c2.PNG c3.PNG


    These are the settings used for this bake (with one mixed directional light):
    upload_2018-3-4_20-48-37.png

    Increasing the resolution to something like 100 makes the squares smaller, but does not eliminate them. Same thing with samples, bumping them up to 60 direct / 1000 indirect / 4 bounces doesn't help.

    During the bake, the dark parts sometimes disappear and reappear, but they are always present in the end. The ground is a custom circular mesh about 30 units across (the area visible in the screenshots is around 7-10 units).

    The resolution also seems fine:
    upload_2018-3-4_20-53-29.png


    Switching to Enlighten however, makes the artifacts go away.

    Any ideas?
     
  49. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Can someone provide a technical explanation for why the curvature of normal maps is destroyed for baked lighting but not realtime lighting?
     
    legoblaster1234 likes this.
  50. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    Start a new bake and switch the scene view to the Texel Validity view. Is it full of red? If it is, create new lightmap parameters, and switch the backface tolerance value to 0 and see if that fixes things.