Search Unity

Official Progressive GPU Lightmapper preview

Discussion in 'Global Illumination' started by KEngelstoft, Sep 26, 2018.

  1. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I mostly get this error which causes the system to fallback to PLM CPU:
    Assertion failed on expression: 'IsCLEventCompleted(events->m_StartMarker, isStartEventAnError)'

    And then this:
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_PROFILING_INFO_NOT_AVAILABLE
     
  2. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I'm also constantly getting this error, Currently in 2018.3 b3, but this happens a lot in previous 2018.x:

    There are 69 objects in the Scene with overlapping UV's. Please see the details list below or use the 'UV Overlap' visualisation mode in the Scene View or Lightmaps in Lighting Settings for more information.

    for meshes part of an FBX which has "Generate Lightmap UVs" option enabled in import settings, which probably means that there are no proper uv2's generated.

    upload_2018-10-3_16-3-40.png

    upload_2018-10-3_16-3-3.png

    And this is the actual UV - visualised in custom editor - looks ok !

    upload_2018-10-3_16-19-26.png
     
    Last edited: Oct 3, 2018
    subhomukh1407 likes this.
  3. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    I've tried this in a few scenes noticed that the device name has changed from 900 to 901 and had amazing GPU enhanced rendering times to CPU hogging endless rendering to crashes the IDE graphics rendering (turned black) to crashes rendering of windows (sound still worked).

    What settings are best for quick rendering on the GPU without crashing or getting bogged down in clustering on GI?
     
  4. Codev

    Codev

    Joined:
    Oct 8, 2015
    Posts:
    5
    Nvidia 411.70
     
  5. fguinier

    fguinier

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    146
    Hey actually was would be really usefull would be a bug report with the following information:
    - driver before (if you have the info)
    - driver after (so i guess 411.70?)
    - the scene
    - the graphics card model (and memory)
     
  6. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    As I pointed out earlier in the thread the "Clustering" is part of the realtime GI process and has nothing todo with the GPU Lightmapper. There are two systems for the lighting in Unity, one handles realtime GI (moving lights with GI) and one handles baked GI (static lights baked out to lightmaps) and the GPU Lightmapper is a faster alternative to the second category. To avoid clustering disable "Realtime Lighting" in the "Lighting" tab. Or make all your lights mixed or baked and make your environment baked ("Ambient Mode") and make all your (non black) emissive objects baked too ("Global Illumination" set to "Baked" on the emission on the material). If you do that "Clustering" wont run.
     
  7. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Unfortunately, this is a misunderstanding, primarily due to our choice of wording in the UI. The UV overlaps in the warning are not referring to overlaps in the UV space (continuous) but overlaps in lightmap space (discrete texels), i.e. texels from several charts that are too close to each other.

    I would recommend you to read this page which was written exactly for situations like yours:
    https://docs.unity3d.com/Manual/ProgressiveLightmapper-UVOverlap.html
    Perhaps you would also find my reply here interesting:
    https://forum.unity.com/threads/overlapping-generated-lightmap-uvs.522747/

    Try to visualize your overlaps via Unity's visualization tools, like shown below. This will help you understanding the cause of the warnings.

    (the other console warnings/errors are unrelated)

    Some possible solutions to this problem are explained in the manual page linked above.

    We are aware that this behavior is indeed not optimal. It would be better if Unity somehow came up with a packing layout that would guarantee no overlaps (in lightmap space) instead of just using the scaled and offset input UVs directly. At the moment I cannot promise anything specific, but we are considering how to achieve this goal.
     
  8. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yeah, this is actually confusing! However i am now aware of its meaning. Will have a look at the links. Thanks a lot !
     
  9. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    I feel like that gif should be in that docs page, or even better if that were somehow linked into the editor(like click the console warning for more info and that pops up).
     
    Vagabond_ likes this.
  10. Codev

    Codev

    Joined:
    Oct 8, 2015
    Posts:
    5
    Ok, the first driver is 399.07, after I updated to the version 411.70 and now I have updated to the version 416.16 (the problem on unity also persists with this driver)

    GPU : Nvidia GTX 1060 6GB

    The scene : https://drive.google.com/open?id=1N_P6bLpnTH1s4aUT8kJbhYkIQuGlWstn
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    Just throwing this out there, maybe something like "Texel Bleeding" would be better? Overlapping UVs implies there is something inherently wrong with the UVs, which might be false (for example, they could be just fine if you did a higher res bake).
     
    Adam-Bailey and Hypertectonic like this.
  12. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I tested the GPU lightmapper in current Unity 2018.3.0b4.
    Seems already stable and very promising.

    But, as I already mentioned in other threads, I seriously beg Unity developers to implement a

    "Bake selected object(s)" - button.

    (Imagine a single table with a little cube on it in a 5x5m room.
    When I move the cube a little bit it would be fine to rebake the table and not the whole room, which will save tons of time.)

    Please!
     
    SamAB likes this.
  13. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    May I ask why moving the realtime GI to GPU is not in the plan?
     
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Might be because it was using enlighten which i assume Unity doesn't have access to the source code to modify it. Unlike the progressive lightmapper it was Unity developed
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    Also, brute force algorithms are easier to translate to GPU.
     
  16. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    So the lastest beta 2018.3.b5 still fails to properly bake any of my scenes/tests without reverting to CPU when encountering an issue. Guess I will have to wait even longer before this become useful. Shame.
     
  17. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    LIT_GPU.png gpu3.png GPU2.png LIT_CPU.png
    very bad for the same scene bake with gpu bake, what's wrong??the cpu bake good very better...
     
  18. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    You GPU bake time is 3.42 and CPU is 10.47, so I don't understand why you think CPU is faster? Also you are using Precomputed Realtime GI on top of baked GI, so some calculations are still on the CPU (the Enlighten precompute part for precomputed realtime GI). We can't move realtime GI precompute to the GPU, as that is done inside Enlighten.
     
  19. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I highly doubt this. Unity implemented this feature into Unity, which means they had access to source code - unless there is a magical box that cannot be altered or modified but still can be accessed for use. I'd understand if there were legal issues, but source code blackbox sounds absurd.

    Also we are talking about using GPU baking to bake data that is to be fed into Enlighten, which btw, is what the progressive lightmapper is doing. So it has already been done, not quite apples to apples but is a good indicator.

    Nevertheless, I could be totally wrong and want to know KEngelstoft thinks.
     
  20. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    well he did state this in the post above "We can't move realtime GI precompute to the GPU, as that is done inside Enlighten."
     
  21. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I see, oh well...that really sucks then...
     
  22. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Well for now we can only that hope unity have their own realtime GI in the future
     
    optimise likes this.
  23. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Raytracing support is coming to HDRP, and there is SEGI for voxel based GI. In another words, Unity will most likely not add realtime GI or improve it. My guess is that they will let it slowly die :D hahaha!
     
  24. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    cpu bake lightmap is correct ,gpu missing the shadow....
     
  25. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    It looks like it is because rays from the ground plane is hitting a lot of back faces. This is expected as Double Sided GI support isn't there in 2018.3. Please retest in 2019.1 alpha/beta once available as the feature is implemented in that release.
     
  26. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Good suggestion, thank you. We will definitely consider that.
     
    AcidArrow likes this.
  27. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    This issue should be fixed in 2018.3.0b7 :)
     
    NeilC and Vagabond_ like this.
  28. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    I got an error with the GFX 1080 and 8700K, should I install OpenCL or something?
    Failed to find a suitable OpenCL device, falling back to CPU lightmapper.
     
  29. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    OpenCL support is in the GPU driver. Just be sure to have the latest driver installed and you should be good !
     
  30. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    Should an hd630 be faster or slower than a 8700k? I had a few bakes where the mrays was lower than the cpu but the gpu finished faster?
     
  31. fguinier

    fguinier

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    146
    Mrays is calculated based on the time it take to do the path-tracing algorythm (including shading).
    Once that is done we combine and filter the outputs to produce the lightmaps, we call that compositing.

    Compositing and rendering are both accelerated by the GPU implementation, but the speed up react differently for both. For example for a very simple scene with huge low occupancy lightmaps you will probably see more speed up on the compositing part than on the path-tracing part. IE mrays won't sky rocket but bake time will improve substancially.

    In the end the perf benefit versus CPU and GPU is both hardware and scene dependant thus.
     
  32. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I have one question !

    As GPU Lightmapper is using RadeonRays, can we expect it to run somewhat better on AMD hardware, or nVidia takes the lead here as well !?

    For example do you have any comparison between let's say RX 570 and GTX 1060 as they suppose to be close on performance in general ( well 1060 should be a little bit faster ) !?
     
  33. Dubada01

    Dubada01

    Joined:
    May 29, 2017
    Posts:
    10
    I've got a scene in which I'd like to bake the shadows of my terrain trees. I just went ahead and created actual objects in place of each tree, and am attempting to bake the scene with these thousands of tree objects marked as lightmap static.

    I've never had the patience to let this bake via CPU, and I would like to bake it using my GPU. However, my 2080ti doesn't have enough dedicated memory to bake the scene. What is the best way to reduce the memory usage of a lightmap bake?

    Thanks!
     
  34. fguinier

    fguinier

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    146
    One way easy way it to reduce the size of the lightmaps.
    Btw we have plenty of memory optimization in the pipe :)
     
    Lars-Steenhoff likes this.
  35. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    84
    Failed to find a suitable OpenCL device, falling back to CPU lightmapper.
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_INVALID_PROGRAM

    Drivers updated on R9 280x
     
  36. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    This is unexpected, please file a bug report with the Editor log attached so we can investigate why the program compilation fails. https://docs.unity3d.com/Manual/LogFiles.html
    Thanks!
     
  37. houghtob123

    houghtob123

    Joined:
    Aug 25, 2017
    Posts:
    5
    Any idea on why the MRays/sec fluctuate so wildly between 1.5-120 MRays/s? This is baked lighting only with 200 direct, 1500 indirect samples, 3 bounces, 30 texels and 1024 res lightmaps.

    I've seen some people say it may jump over to virtual memory but would virtual memory bog it down that much? Though task manager says my secondary card only uses 5gb so could it just poor scene setup on my part?


    i7 6700k 4ghz
    2 x GTX 1070 8gb drivers 416.34
    32gb ddr4
     
    Last edited: Oct 28, 2018
  38. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Does this happen when you change between applications so the Editor loses focus? It is much easier to reason about if you capture this in a small video clip...
     
  39. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    83
    CL_MEM_OBJECT_ALLOCATION_FAILURE error executing CL_COMMAND_NDRANGE_KERNEL on GeForce GTX 1060 3GB (Device 0).

    CL_MEM_OBJECT_ALLOCATION_FAILURE
     
  40. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Try lowering the lightmap atlas size, you will run out of memory if you try and bake a 4K lightmap on a 3GB card. We are aware of this issue and will fix it before going out of preview.
     
  41. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    84
    UPDATE: Work with new drivers update 18.10.2
     
  42. houghtob123

    houghtob123

    Joined:
    Aug 25, 2017
    Posts:
    5
    I took a video of what is going on. I think I have it somewhat narrowed down after doing different tests for the video. I figure the fluctuation is actually just a long increase in MRays/sec because it goes up slowly and only decreases a little bit. The behaviour is not due to losing focus, as you can see in the vid. Maybe Unity is displaying the average MRays and not current?
    A more reproducible issue I have noticed is that the maximum MRays/sec seems to be limited by the lightmap resolution selected. Is this supposed to happen?
    Sped up video:
     
    Last edited: Nov 4, 2018
  43. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    103
    I'm on 2018.3 and I don't see the option of the GPU lightmaper preview at the lighting tab.
    On the Package Manager I don't see either the option to install the package.
    Where can I find it?
     
  44. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    There is no way to get it from package manager.
    It is included inside unity already in the lighting window.

    What GPU you have !?
     
    GorkaChampion likes this.
  45. fguinier

    fguinier

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    146
    GPU Lightmapper is not a package it is embedded in the editor. At the moment it is only available on windows, could it be the problem?
     
  46. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    103
    Ahhh, ok. I tried on a Mac. I'll do on Windows later today. Thanks.
     
  47. fguinier

    fguinier

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    146
    My gut feeling would be that the GPU is under utilized here.

    An interresting test could be the following:
    - Remove view prioritisation (so only one lightmap will be baked at a time and it is easyer to track the behavior)
    - Change lightmap resolution and lightmap size to make the amount of occupied texel varies and see if it relate to the speed problem.
    - If this seems to be the problem please wait we are on it (will be fixed before we move out of preview), if this is not the problem we have a bug here.

    Some details on the current behavior:
    At the moment performance drop when the amount of occupied texels to process in a lightmap is small (from the point of view of the GPU at least a million item is a good target). We don't have special handling for low occupency yet, thus a 1k lightmap with an occupency of 25% will result in 250k texel to process and would not be ideal for the GPU. On the other hand a 2k lightmap with an occupancy of 70% would make the GPU very happy with 2.8millions texel to process.
     
  48. hunvee3

    hunvee3

    Joined:
    Dec 27, 2014
    Posts:
    4
    Hi!, I'm using a sapphire amd r9 270, and was wondering if it will be able to handle the gpu lightmapper
    Also my CPU is an AMD ryzen 5 1400
     
    Last edited: Nov 10, 2018
  49. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    I'm playing with the GPU Lightmapper in the 2019.1.0a8 build. Partway through baking I got a red console error appearing for half a second before vanishing. I had to restart the bake a couple of times to try and get a glimpse of it but it seemed to say something about out of memory. The bake continued fine however, should I assume that means it's falling back to the CPU lightmapper?
     
  50. Harrier

    Harrier

    Joined:
    May 11, 2015
    Posts:
    8
    I have GPU R9 390 with 18.11.1 drivers ( i tried also 18.10.2) and 2018.3.0b9 unity.
    And i got this same warning spam for all three lightmapper options, what is going on? (i cleared console every time before clicking on generate lighting)
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_INVALID_PROGRAM

    i made video:
     
    Last edited: Nov 11, 2018
    amritt_unity likes this.