Search Unity

Official Progressive CPU Lightmapper

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

  1. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    The feature has landed in 2019.2. Look out for
    Contribute Global Illumination
    checkbox and the
    Receive Global Illumination
    dropdown (Lightmaps / Light Probes) in the Mesh Renderer's options.
     
    Adam-Bailey, MAK11, konsic and 2 others like this.
  2. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Just checked out the 2019.2 alpha and awesome to see it working. I assume it isn't going to be supported with Enlighten (doesn't currently work at least) so might be worth giving a notice to users if Enlighten is selected. Spent a couple of minutes trying to figure out why ambient light wasn't baking into the probes correctly until I realised I hadn't switched to Progressive.

    Super quick and dirty test with a grid of probes and a single 8*4*8 LPPV.

    LightProbeOnly.JPG
     
    Jesper-Mortensen likes this.
  3. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    @Adam-Bailey actually it's meant to work when baking with Enlighten as well and the internal automated tests show that it does. Would be great to get a bug report with your project, even though I don't expect big differences between that and our tests... there is at least one. :)
     
    Adam-Bailey likes this.
  4. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Just reported it with the title Light not baking into light probes using Enlighten in 2019.2.0a4. I narrowed down the issue to occurring when Realtime GI is ticked in the Lighting panel.

    ProgressiveCPU.jpg Enlighten-RealtimeOFFBakedON.jpg Enlighten-RealtimeONBakedON.jpg

    I'm keen to find some time to test this out in a large environment, having emissive surfaces working without any lightmaps is fantastic.
     
    Last edited: Feb 15, 2019
    Kuba likes this.
  5. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! Make sure that Ambient Mode is set to Baked, as opposed to Realtime when you toggle Realtime Global Illumination on.

    Also, regarding emissive materials; since Unity 2019.1, we have exposed Global Illumination: None parameter in the material UI. See the screenshot below:

    Unity_yIBHaasgJo.png
     
    konsic likes this.
  6. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    This is interesting

     
  7. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Yeah, checked that. In the example project submitted there are other light types as well.
     
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    How to use OptiX denoiser? the denoiser option are greyed out.
     
  9. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    I got this error message but lightmapper started anyway. What does it mean ? //2019.1b7

     
    Last edited: Mar 15, 2019
    JamesArndt likes this.
  10. MAK11

    MAK11

    Joined:
    Nov 24, 2017
    Posts:
    11
    Link to Jepser's scheduled GDC Talk about the integration of Intel Open Image Denoiser in Unity 2019.x
    https://schedule.gdconf.com/session...lightmaps-presented-by-unity-and-intel/865250
    Just wish that non Nvidia owners will have a GPU based solution one day. Intel's solution looks good enough for now.
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    No need, really. From testing it seems Open Image Denoise is either on par or better than Optix.
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Hey so I'm having an issue with light probes, for quite a while actually.

    It has to do with how I lit my scenes very indirectly and I really like using small emissive meshes. This leads to sometimes the lightprobes missing the light source and it makes them have inconsistent results.

    So for example, here is a very exaggerated example of this issue:
    Probes2.jpg
    It's exaggerated because I went out of my way to maximise the inconsistence in order to showcase the issue.

    Here is another more "normal" example:
    Probes.png

    I can usually work around these, by editing the positions of the probes that look way out of place and slightly moving them, so I can roll the dice on their sampling again and cause them hopefully miss less stuff. The workaround works, but combined with how I can't really just bake the light probes by themselves it makes it kinda slow and painful to fix things.

    I actually did a bug report for this, it's case 1135553 , but I'm not sure if it's a bug or a feature request for "improved sampling light probe sampling".

    I'm guessing this is a side effect of the way the light probes do the sampling, which was probably tailored more for speed?

    As I said, I'm not pushing for this to be a bug, it could be a feature request (and in that case, it's one I'm actively requesting, for whatever's that worth :) ).
     
    konsic likes this.
  13. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Is it possible to just make global light probes? So, engine would create a grid of light probes across all of prefabs so that user don't have to place them on exact spots.

    I suggested this some time ago as feedback.
     
  14. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
  15. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    I was think like in UE4 but for LP. They could be generated in all space and based on distance to prefabs.

     
  16. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi! Thank you for reporting this! The probe sampling does have a problem where sample counts are not respected.
     
    WildStyle69, konsic and AcidArrow like this.
  17. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    That's right. There are slight differences as they were trained against different data, but overall they are comparable in quality. The Optix one appears to produce slightly blurrier/smoother results; that may be good or bad depending on your assets.

    The presentation is here: https://drive.google.com/file/d/1evcgkYLhEpGGNhCPLQgnWY6njrRNERoX/view
     
    konsic likes this.
  18. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    486
    Can OID potentially be used for realtime raytracing or its too slow for it?
     
  19. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    It would very awesome with a single pass AI denoising in realtime! Currently however, AI denoising is nowhere near fast enough for realtime so it is only for offline uses. Denoising for realtime raytracing is very much intertwined with the individual techniques themselves which is one of the main problems of the current generation of RTRT algorithms. In our preview RTRT build we use a per effect joint bilateral gaussian filtering with a temporal buffer. This is an area of active research.
     
    hippocoder likes this.
  20. RigoCL

    RigoCL

    Joined:
    Sep 22, 2015
    Posts:
    9
    Hi, same problem here using just downloaded 2019.1.0f2, mine is:

    [PathTracer] AddGeometry job with hash: f1bf86363eb5f32bc3afcce7b85c6719 failed with exit code 1.

    The problem is this error shows over and over again while "Preparing bake...", I mean same hash is shown thousands of times, so the preparing never ends...
     
    galaskap likes this.
  21. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    This very cryptic message means that some vertex channels might be missing. Do you have the following channels in the failing geometry? Vertex, Normal, TexCoord0, TexCoord1?
     
  22. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    I came across this issue today and now I'm wondering if there is any progress or ETA on this?
     
  23. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Hi Peter, unfortunately the spatially coherent packing has been put on hold due to other issues taking priority. We still want to add it, but I cannot say when or if it will happen. I also responded to your specific question in your own post.
     
  24. galaskap

    galaskap

    Joined:
    Aug 14, 2017
    Posts:
    1
    I've been getting this same message in 2019.1.9f1...I'm on a Mac and get it for both GPU and CPU...Where would we check our vertex channels? I'm using Blender 2.79b and tried exporting just a plain cube but still get this message. I have "Generate Lightmap UVs" checked.

    EDIT: I am using LWRP as well.
     
    JamesArndt likes this.
  25. Gervais60

    Gervais60

    Joined:
    Apr 7, 2016
    Posts:
    37
    Can't use progressive light mode in unity 2019.1.10f when use the GPU the program simply crash and with the CPU I get the following error for all object in the scene

    This project was working correctly in 2019.1.9f

    [PathTracer] Failed to add geometry; mesh is missing required attribute. Please make sure mesh contains positions, normals and texcoord0.

    [PathTracer] AddGeometry job with hash: f8e3c13a656530e92e61ee50e5ea77a2 failed with exit code 1.
     
    Salvador-Romero and galaskap like this.
  26. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Select the mesh in the project view, then you can see the channels in the inspector in the bottom of the 3d mesh preview.
     
  27. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Any ideas? 2019.2.4
     

    Attached Files:

  28. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Are you using non uniform scaling on the cube?
     
  29. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    No, everything is by default and builtin. Important note: this happens if there is a cutout or transparent object near the light source (point or spot).
     

    Attached Files:

  30. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi, I have reproduced this and created case 1183940. Which version of Unity are you using?
     
    StenCG likes this.
  31. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    2019.2.4f1
     
    KEngelstoft likes this.
  32. MafiaMoe

    MafiaMoe

    Joined:
    Mar 24, 2013
    Posts:
    27
    Our scene seems to have contracted some awful disease, blotches of 'miscalculated dots' appear in higher number as we crank up the number of samples. So far we have noted:

    - It only seems to happen in this one room/area
    - Increasing the pushoff helps from 0.001 to 0.01 helps but further increases have no effect.
    - Increasing the samples of any type increases the count of these blotches.
    - Increasing the denoising doesn't fully cover up the blotches (even to highest values)

    upload_2019-9-27_15-50-39.png

    upload_2019-9-27_15-53-23.png

    upload_2019-9-27_15-53-59.png
     
    konsic likes this.
  33. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Does it happen without the AI denoiser enabled? Or by denoising do you mean _filtering_?
     
  34. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    How can I avoid this problems when a object have before the back of other object?

    upload_2019-10-2_16-31-10.png

    upload_2019-10-2_16-31-28.png
     
  35. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Hm, I am not sure what it is that you are seeing. It looks a bit like lightmap dilation (at least in the first photo), but that really shouldn't happen there (since the wall is not covered up). A few things to try:
    1. Verify that you have indeed updated the lighting after you last moved static geometry. This is just to make sure that the lighting is up to date. I write this because the first image looks like you baked and then moved static geometry (without rebaking).
    2. Try viewing your scene with the "Texel Validity" debug visualization. For more information about Texel Validity check out the section of that name on this page. If you see something unexpected in this visualization, you may post a screenshot of what you see, and maybe I/we help you based on this.
     
  36. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    I have need change the backface tolerance to 0.3 in a custom lightmap parameters. I see excesive the default value in medium, 0.9 and with the problems that I see in simple scenes.
     
  37. ledbetterMRI

    ledbetterMRI

    Joined:
    May 29, 2019
    Posts:
    25
    Lot's of great info on the Progressive Lightmapper in the Unity Docs, but there's a blind spot about Indirect Resolution that I could use some clarification on.

    On the intro page here: https://docs.unity3d.com/Manual/CPUProgressiveLightmapper.html,
    the Indirect Resolution setting is named and given a recommended value for environment light vs indoor light.

    Yet, on the "Getting Started" page here: https://docs.unity3d.com/Manual/Lightmapping.html,
    the same Progressive inspector window shows this value grayed out as either irrelevant to Progressive lightmapper, or inoperable due to some other project setting.

    So, should I be able to set my indirect texel resolution in Progressive mode? My current project has this option grayed out and I would like to see what changing this value does to the final result (if it's actually relevant). I'm currently using 2019.2.2f1.

    Thanks for your help!
     
  38. MafiaMoe

    MafiaMoe

    Joined:
    Mar 24, 2013
    Posts:
    27
    Yes, I mean changing the filtering options in the Lightmapping Settings doesn't remove the blotches. The different filters only change how the blotches are handled.

    Here is a partial lightmap using a different filter that shows the blotches when using the A-Trous filter instead of Gaussian. The blotches show up in the exact same pattern on the wall as the previous post:
    upload_2019-10-3_2-46-43.png

    Curiously, no 'pure-black blotches' show up with no filtering:
    Lightmap 500 10000 500.PNG
     

    Attached Files:

  39. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    You need more indirect rays, and if you are using 2019, try the AI denoise stuff.
     
  40. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    As you may know, Unity integrates a library called Enlighten which can be used for various lighting calculations. The "Indirect Resolution" specifies the "coarseness" at which Enlighten performs its lighting calculations. Note that this is not necessarily the same as the resolution of a resulting lightmap.

    Enlighten is active when
    1. You use Realtime GI (see checkbox in Lighting window), or
    2. You use Enlighten as the Lightmapping backend (as opposed to Progressive CPU/GPU).
    So if you are using the progressive lightmapper and realtime GI is disabled, then indeed "Indirect Resolution" is not relevant for you. This would explain why it is greyed out.

    Please also be aware that Enlighten is being deprecated and won't be part of Unity in the future (which also mean that "Indirect Resolution" will go away).
     
    ledbetterMRI likes this.
  41. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    That is peculiar indeed. To be sure I understood you correctly: does the dark spots appear only when you enable filtering? This would suggest that it is the filtering process that somehow causes this.

    Does it happen with all kinds of filtering (Gaussian, Atrous, AI) or only some of them?

    To properly debug this it would be helpful for us to a have a minimal scene that exhibits this issue. If you use "Help > Report a Bug" in the top menu, you can attach a copy of your current scene. You may be able to create a minimal scene by iteratively removing objects from your current scene (while making sure the issue is still there). As a potential side bonus, such a iterative process may give you more insight into why this is happening.
     
  42. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
  43. MafiaMoe

    MafiaMoe

    Joined:
    Mar 24, 2013
    Posts:
    27
    Yes, it is happening with every filter/denoiser combination available.


    Update: The issue was a couple baked area lights.

    I copied the scene over and started removing items like suggested. Of course I got all the way down to only a handful of items until there were just lights and the offending objects. Finally turning off the two baked area lights atop the walls fixed the issue immediately. Returning to the original scene and turning off just those two lights fixed it there as well.

    Partial light bake after the two baked area lights are disabled:
    upload_2019-10-5_16-34-1.png
    upload_2019-10-5_16-38-1.png

    I can't imagine this happens with every baked area light, but perhaps this issue arose due to the area lights intersecting geometry?
     
    Last edited: Oct 6, 2019
  44. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    In which way should I use progresive lightmapper with light probes new feature in 2019.2?
     
  45. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I think there is something wrong with the RGBM decoding

    Setting Lightmap Encoding to medium, is appreciably lighter than all other encodings.

    1 alleyRGBM.jpg
    2 RGBM.gif

    I tried this:

    Code (csharp):
    1. #ifdef SWITCHDECODE
    2. c.rgb *= DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv[1])).rgb;
    3. #else
    4. float4 lm = UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv[1]);
    5. c.rgb *= (4.59 * lm.a) * lm.rgb;
    6. #endif
    These should look the same, but they don't. My hacked one looks correct, while the Unity macro DecodeLightmap is brighter.

    To make them look the same (wrong, but the same), I should change 4.59 to 5.0. Which means for some reason decodeInstructions.x is being set to 5.0 instead of 4.59.

    I do not know how decideInstructions in being set, but I can only conclude that it's this:

    // These constants must be kept in sync with RGBMRanges.h
    #define LIGHTMAP_RGBM_SCALE 5.0

    So, is it in sync with RGBMRanges.h ? Why is it set to 5.0 instead of pow(2.0, 2.2) = 4.59 ?


    I was wrong about what the solution is, but the general point still stands.

    Bug reported, Case 1207489.
     
    Last edited: Dec 24, 2019
    StenCG, JamesArndt, iamthwee and 2 others like this.
  46. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    Can Progressive Lightmapper be utilized for creating static global illumination ? A global illumination effect which is fixed in space.
     
  47. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    So QA replied with this:
    So I tried a completely different machine, a mac mini, and it's the same thing.
    rgbm.gif
    The effort that a bug report needs, narrowing things down, creating a minimal repro, screenshots, fighting QA, is approaching the same time it would take me to maybe actually fix the issue if I had source access, or, to the naysayers that say source access is not important: time I could actually be doing something productive.

    Spending so much time, just to roll the dice of to maybe see issue fixed in a year or two...

    It's not worth it.

    For this specific issue, if anyone else cares, you can pick up the slack. If it's only me that cares, no other Unity user, nor Unity employee, then it might as well stay not fixed.

    I'm done with bug reporting this or any bug for that matter.
     
    mh114 likes this.
  48. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Hey @AcidArrow, sorry to hear about your bug reporting experience. ;(

    Our QA does their best to try to reproduce the bug in various environments, on different Unity versions (to e.g. prove whether something is a regression), etc. It might sometimes happen that we ask you for more information too hastily. Please don't take that as us throwing the issue back over the fence. It's just a way to gather more information that we are currently missing.

    I understand that it might feel like we're putting the burden of gathering more info on you. That's not the intention. It's just one way for us to learn more about about the issue. It's perfectly fine to answer "I don't have more data.".

    Within the team we have frequent conversations between QA and devs about bugs that can't be reproduced to brainstorm on possible ways of approaching the issue. Also, it's of course not strictly needed for us to reproduce the issue to be able to fix it, but that makes it much faster. That's why it's the first thing that we try.

    I really appreciate the amount of work you've put into reporting bugs and hope that we didn't lose you forever.

    Cheers,
    Kuba
     
    Jesper-Mortensen likes this.
  49. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Tried reproducing this myself. Here is the result:


    Am I doing it wrong? This is on windows with Unity 2019.3f4. Have you tried this on windows? Potentially it is Mac specific.
     
  50. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We added the option to crank up the sampling for probes now. This helps a lot in these cases, where lighting is difficult to find. It shipped in 2019.3.
     
    Lars-Steenhoff likes this.