Search Unity

Official Progressive CPU Lightmapper

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

  1. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    I also reproduced case 1207489 in 2019.2.15 and 2020.1.0.a16, Windows, only gamma space (linear no problem)
     

    Attached Files:

  2. kslusarz

    kslusarz

    Joined:
    Mar 1, 2018
    Posts:
    7
    Hello,

    I've posted some time ago my little issue with onesided meshes casting those buggy shadow :
    https://forum.unity.com/threads/lightmappers-buggy-shadows.784130/

    Now I read I'm suppose to change the backface tolerance. I've tried few values ( 0.0, 0.5, 0.9, 1.0 - not exacly in that order) and while there's some difference, it still looks equally bad :(

    Is there any way to fix that problem?

    Adnotacja 2020-01-16 170027.png Adnotacja 2020-01-16 170027.png Adnotacja 2020-01-16 170103.png
     
  3. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    If you have open meshes use a material with Double Sided GI enabled on the meshes that are open (not the ones that the artifacts appear on!). In HDRP the Double Sided GI property is automatically set if you make the material double sided.
     
  4. kslusarz

    kslusarz

    Joined:
    Mar 1, 2018
    Posts:
    7
    Thanks again :).
    What are the side effects (performance or baking time) of using doublesided GI?
     
  5. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    It’s negligible. But of course you will be tracing paths from those broken texels, but that’s unavoidable, and desirable too. Hope it works for you now. I am considering changing the behaviour for this.
     
  6. dgoodman-icf

    dgoodman-icf

    Joined:
    Jan 7, 2019
    Posts:
    36
    Where is this option found?
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    In settings or prefs. Dig through and it'll be in one of them. It won't be on the actual probes.
     
    dgoodman-icf likes this.
  8. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yes as @hippocoder says you can find it in "Edit->Project Settings->Editor->Use legacy Light Probe sample counts" it should be unticked to use the new way of specifying Probe sample counts. It is an option like this to avoid breaking upgraded projects. I you hover the greyed out setting in the Lighting Settings window it will also point you there.

    Cheers,
    Jesper
     
    dgoodman-icf and hippocoder like this.
  9. dgoodman-icf

    dgoodman-icf

    Joined:
    Jan 7, 2019
    Posts:
    36
    Oh wow I never would have looked there! Thanks much :)
     
  10. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    Is it better to scale the world and the player down to 0.2 meters if you want to get less lightmap size.
    The usual would be to have player 2m tall and scale the world accordingly. But, does that use bigger lightmaps since it's is greater distance to world's origin.
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's not a good plan. Use the scale in lightmap parameter for meshes.
     
    JoNax97 and Mark_29 like this.
  12. Mark_29

    Mark_29

    Joined:
    Aug 11, 2014
    Posts:
    79
    Change the scale of the lightmap resolution globally (via the lighting window) or as hippcoder suggested, on a per object basis via the meshes lightmap settings.
     
    hippocoder likes this.
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    To climb Everest... I will scale these heights!
     
  14. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    Does lighmapper have internal importance boundary volumes around geometry ? I would control light baking with boundary volumes.
    For exmaple, if you bake lighting for interiors, areas outside the importance volume should only get one bounce of indirect lighting at a lowest quality.
     
  15. eiwzkart

    eiwzkart

    Joined:
    Feb 25, 2016
    Posts:
    62
    I use CPU render and this is happening to the same object at difference transform, so weird

    really cannot figure out what is wrong, as I research deeper, it turned out to be the shadowmask map is not correct(one face is getting some black spot) if the box is at distance transform(for example x=2500),

    it also happens to the enlighten renderer

    upload_2020-5-10_13-11-28.png

    upload_2020-5-10_13-8-39.png
     
    Last edited: May 10, 2020
  16. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    You may be seeing self intersection artifacts when you're far off the center. Adjusting the pushoff value in the parameter should fix this.
     
    JamesArndt likes this.
  17. Zylex

    Zylex

    Joined:
    Nov 25, 2008
    Posts:
    238
    Does upgrading memory help when baking with CPU? I currently have 32 GB and I see it nearing 30GB while baking. Would it speed up if I had 64GB?
     
    JamesArndt likes this.
  18. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I would say that RAM would play a small role, but not substantial considering how much RAM you do have. 16GB works efficiently for most scenarios and you're doubling that. Most of the speed for the CPU Lightmapper is likely going to come from your CPU and motherboard configuration. The better a GPU you have, the better the GPU lightmapper will work.
     
  19. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    How progress?
     
  20. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  21. cwrightvdi

    cwrightvdi

    Joined:
    Apr 29, 2020
    Posts:
    4
    Is anyone else having an abnormally large GI cache? I am using 2019.3.13 and baking large scenes with the Progressive Lightmapper and while I am using 2048 maps and a texel resolution of 10, I do expect there to be a big cache. But, my scene's lightmaps are only a total size of 5.98 GB and my cache is well over 200GB. Is this normal? Does baking multiple scenes continuously add to the size (I have baked about 3 all of the same size and asset types)? Is there a setting besides the Cache compression toggle (which I have on in the GI cache prefs) that may be helpful to reduce this?
     
    Last edited: May 27, 2020
  22. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Yes, you can manage the size, location, and compression of the GI Cache using the GI Cache preferences. For more information, see https://docs.unity3d.com/Manual/Preferences.html#GI-Cache.See https://docs.unity3d.com/Manual/GICache.html for more details about the cache itself.
     
  23. cwrightvdi

    cwrightvdi

    Joined:
    Apr 29, 2020
    Posts:
    4
    So in essence, no there is nothing else I can do. Those preferences I already have set. There's not much to them. Cache compression is on and the size I have set to 200gb (that obviously does not limit it as my cache is currently 230+gb). So is this the normal? I have done this same baking in previous versions of Unity and the cache never got over 100GB. Did something change in Unity 2019? Is this possibly a bug?
     
  24. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Unity will hold on to GI Cache data which is still in use by the current bake, but 230GB does sound like a lot, if your scene is huge this is not unrealistic though. You can use the Editor GI Cache preferences window to clear the GI Cache but then your next bake will start from scratch instead of getting a speedup from the cached data.
    Please do keep in mind that the biggest user of GI cache data is Enlighten, for both precomputed realtime GI and baked lighting. The Progressive CPU lightmapper doesn't produce nearly as much cache data, so please check your settings - is realtime GI turned on?
     
  25. cwrightvdi

    cwrightvdi

    Joined:
    Apr 29, 2020
    Posts:
    4
    I have had Realtime Global Illumination turned off in each scene. I have been not wiping the cache as (in previous builds I had to do this) I need to share the baking cache between multiple coworkers or it will not apply correctly. As I mentioned they are huge world scenes but I baked the same scenes in a previous version of our product and they did have a smaller cache. If I can clear the cache and not have to share anymore between coworkers' machines and the several baked scenes will still look correct than this is not as big of a worry.

    So, is it possible to clear the cache and not lose or disorient the baking data between editors on different machines?
     
  26. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    There is no need to share the GICache with your co-workers, all the baking outputs is stored in the LightingData asset, see https://docs.unity3d.com/Manual/LightmapSnapshot.html for more details.
     
  27. cwrightvdi

    cwrightvdi

    Joined:
    Apr 29, 2020
    Posts:
    4
    I do believe there must be a bug. After baking four and a half scenes my GI Cache is 471GB. It is now causing crashes so I cannot complete a bake. I would file a report but this project is not my own and is far too large. I may be having issues with old assets. Is it possible using old/out dated shaders or trees could cause memory leaks? Just curious because like I said I baked these same scenes in Unity 2017 and the cache never had this problem.
     
  28. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    If you do believe there is a bug, please report a bug we can investigate the issue https://unity3d.com/unity/qa/bug-reporting
     
  29. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Can you help me solve these white streaks in the intersecting objects. I am using the default very low resolution lightmap map parameters. I have tried to change the settings there with no change.
    These are Unity default cubes that going through each other at the cross intersections.
    The lightmap settings are mostly default.
    I am using progressive, no ambient occlusion. Mixed lighting-realtime with a baked indirect lightmap.

    Image 3 clearly shows that these 2 cubes have been stretched as rectangles and they cross intersect with each other so this issue is happening at cross intersections and that's why UV error mode does not show any errors.
     

    Attached Files:

  30. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    These do nothing with PLM.
    Remove Gaussian filtering.
     
  31. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hi there removing guassian filtering or even setting all the filtering to none did not show any change.
    I wonder if this has anything to do with the UVW2 of default unity models for the lightmaps.
    Their import settings are not editable so I don't know what to do.
     
    Last edited: Jun 23, 2020
  32. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Hi,

    I have serious problems with both CPU and GPU lightmapper. During the baking process, my device shut down and then restarts. I'm on Unity 2019.4.1f1.
    It never happened during any other baking process, I'm also using blender and Unreal.
     

    Attached Files:

  33. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    You won't find much advice here. For things like that I would highly advise submitting a bug report so someone from Unity can help you through email.
     
    KEngelstoft likes this.
  34. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Ok, I baked with the CPU lightmapper because I do not have enough VRAM to bake my rather large scene any longer with GPU. And I noticed a very huge difference in the outcome of light bounce between CPU and GPU lightmapper. Basically with CPU, everything covered with shadows is mostly pitch black resulting in no GI. GPU seems to be ok.
    Basically I let my computer burn for 3 hours just to get the light bounce missing on most of my surfaces? Now it's worse than without GI. Why is everything mostly pitch black?

    I'm on Unity 2019.4.1f1 with HDRP 7.4.
    Don't know if this is related to the problem, but before the 3 hours CPU bake went successful I had another PC shutdown caused by CPU lightmapper. This also results into my local Unity project got marked by Unity Collab as out of sync "Merge conflicts". I had to reimport the complete project from Unity Collab ...
     

    Attached Files:

    Last edited: Jul 6, 2020
  35. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Your device is shutting down because HDRP is too much for it. Switch to Vanilla or LWRP.
    I see that you are using HDRP and my advice is for Vanilla Unity for the AO help but you might be able to find another AO solution for HDRP if you like. Judging by your computer meltdowns I don't think HDRP is for you HDRP behaves differently from the ground up only for the highest of platforms and to make this clear I get 30 fps in the sample scenes with HDRP and I get 300 fps in LWRP and 300 in Vanilla Unity without there being much visual difference so I highly suggest you rethink your setup if it's not too late. In the meantime I can help you with a rundown of of some of these:
    -There are a few concerns here like your PC crashing and burning.
    -Taking 3 hours to bake tells me you are using the wrong settings-use the default settings in a new scene and see how you go.
    -The difference you are talking about is likely because the GPU Lightmapping is in Beta and not yet as far along as the CPU.
    - If my advise below is of not much help then you should just file a bug report and work with them.
    -I advise you look into lightmapping once again to understand it better because 3 hours isn't making sense to me and you should be pre-baking with very low settings to see your lightmaps before going for the final bake.


    -If you choose to go revert from HDRP and choose vanilla I will share my settings but they can still be ported if you know what you are doing to LWRP and HDRP and if you can figure it out you won't even need lightmapping at all.
    - For indirect lighting get the now free Amplify Occlusion (Vanilla Unity only) and follow the settings I uploaded. With that you won't need baked lightmapping at all and you can use real time lightmaps only as a bonus. For HDRP you can use other screen space AO instead.

    I have uploaded my settings I use in Vanilla and am very pleased with. It has eliminated the need for lightmaps and I also chose to use realtime lightmapping but if I disable it it won't affect look that much since the AO is doing most of the work for indirect lighting but I add it in because it's so cheap and no issues outside the default settings. Sorry I couldn't be of more help so I just threw everything at you haha lightmapping in Unity is still broken even after all these years.
    Also there is an extra Vsync toggle
     

    Attached Files:

    Last edited: Jul 7, 2020
  36. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I know GPU lightmapper is still in preview but regarding my screenshots the CPU lightmapper produces the wrong light bounc (see the pitch black GI) when GPU lightmapper produce nice results (see the comparison screenshot). The lightmaps seems to be ok.
    FPS is not really a problem for HDRP. I get over 90 fps most of the time for my project. Right now my only concern is the lightmapping is not usable to me: 1. GPU lightmapper ask for way too much VRAM. 2. CPU lightmapper causes pitch black areas. 3. Enlighten is deprecated.
     
  37. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712

    Ah I think I understand your issue now! Your issue is not a bug or an error with the GI bounce.
    The GI bounce in the lightmap settings doesn't affect the issue you are talking about.
    These are some of the things that can affect the result of the shadow:

    I think the biggest factor for you would be the settings on your light and shadows and skybox.
    Change the values of your environment lighting from Skybox to Color and increase the brightness to affect the darkness and bounce of your lighting.
    Also if you use realtime GI or Baked GI then on your light there is something called the Indirect Multiplier set it to 0.5 for example and it will lighten or Darken the Bounce from GI in shadowy areas but it only works if you have realtime or baked GI done.
    *All of those settings are already included in the pictures i attached of my last post.
    Let me know if that fixed your issue and in the meantime make sure all of your texel densities and sample counts are default or low to speedup lightmap render times until you resolve your issue then you can up them to final bake.
     
    Last edited: Jul 7, 2020
  38. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I use the Physically Based Sky with a Multiplier of 1.5. I also set the Static Lighting Sky to Physically Based Sky and assigned my Sky and Fog Volume properly.
    My sun has the default strength of 3.14 lux.
    For the Indirect Lighting Controller, I set both Indirect Diffuse and Indirect Specular to 1.0.
    I use Mixed Lighting with Baked Indirect.

    Now the results of GI are nice, like I want them, because I adjusted everything many times. But by that time I used the GPU lightmapper. Now my scene increased in complexity and have no longer enough VRAM to bake with GPU. So I switched to CPU lightmapper and I get the pitch black areas where the realtime shadows are. So do not understand this difference. Why is this not a bug?
     
  39. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi, is it possible to distill your scene down and file a bug report? The GPU and CPU backends produce very close to identical output in most scenarios. I would like to investigate the cause of the differences in your scene.
     
  40. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Now I tried a lot of different settings with the CPU lightmapper and I noticed the main impact coming from the lightmap size. If the lightmap size is equal or less then 256 px, I get the same blue nice looking GI like in my screenshot with GPU lightmapper. But as soon as the lightmap is greater than 256 px, I get brown or pitch black GI from the CPU lightmapper.

    I'm uploading a huge bug report but it's still at 86%.
     
    Last edited: Jul 7, 2020
  41. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Ok, I think the waiting time was for nothing?
     

    Attached Files:

  42. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Short question: Does the baking cost increase linear or exponentional if the lightmap size is increased?
    The same scene under the same conditions have this estimated time for me:
    256 px lightmap = 30 minutes :)
    512 px lightmap = 4:30 hours :eek::eek::eek:
     
  43. xanzarx

    xanzarx

    Joined:
    Dec 4, 2013
    Posts:
    4
    Hi. I have a problem with progressive lightmapper (cpu) on multi socket system. The problem is the lightmapper uses only half of available cores 32 of 64 (on single numa node).
     

    Attached Files:

  44. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Is this thread dead? No answers on my issue since weeks. :(
     
  45. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    baking times depend on the scene a lot. Just bumping the resolution should result in fewer lightmaps overall (depends on scene setup as well), so the total time shouldn't change much if all you've done is bump the resolution in the lightmap settings.

    With regard to your dark lightmaps when using the CPU lightmapper, it looks like you're missing the sky influence (that's what the blue tint is). This shouldn't be related to lightmap size, though, and we haven't seen this specific issue before. A small repro would help us looking into what's going there. In the mean time I suggest double checking the HDRP's sky is setup, there's a specific setting for the baked sky that also needs to be set up correctly.
     
  46. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Thanks for the answer, but I did not changed my baking settings at all, I just increased the lightmap resolution from 256 px to 512 px. Baking time before: about 30 minutes. Baking time now: More than 2 hours.

    About the other issue: I read there is a bug when custom Shadergraphs don't have the exact same property names hardcoded for the lightmapper like "_COLOR", "_CUTOFF".
    I updated all my custom materials manually and this seems to do the trick. Looks ok now.
     

    Attached Files:

    • time.png
      time.png
      File size:
      138.9 KB
      Views:
      337
    Last edited: Jul 23, 2020
  47. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    The baking time is proportional with the number of "Occupied Texels" this number is listed when baking. When using a lightmap size of 256 there are 112.8K texels in your lightmaps, when the size is 512 there is 1.1M texels, for this reason the baking time should be roughly 10 times higher.

    The reason that more texels are generated when opting for larger lightmaps is that objects that do not fit in a lightmap, are scaled down automatically to fit, so the number of texels allocated will be smaller with smaller lightmaps, because the UVs are squeezed down to fit.
     
  48. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Do you know which task it was processing when that happened? What was in the progress bar at that time? It could be a limitation in our underlying ray tracing module, will look into that. What CPU is it?
     
  49. m_stolze

    m_stolze

    Joined:
    Jun 24, 2020
    Posts:
    4
    Hey guys, when I'm baking Lightmaps with either progressive CPU or GPU lightmapper, the resulting shadows get really blocky, but in th eprocess of baking you can see, that it actually has the correct shape and resolution but then keeps erasing details, until it's completely gone. Any idea how to fix that? Enlighten works fine btw.
    UnityLMProcess.gif
     
  50. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    Make the material on the leaves of your palm trees double side.