Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Why is the Lightmapper switching from GPU to CPU?

Discussion in 'High Definition Render Pipeline' started by Alan47, Jan 20, 2020.

  1. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    Hi,

    I've noticed a very odd behaviour of the Unity lightmapper. When I select the GPU preview mapper, I get significantly faster bake times (like 10x faster) than with the CPU mapper, wich is nice. However, as soon as I add any number of light probes into the scene, the baking process automatically reverts back to CPU mode after starting up.

    Is this expected behaviour, or is it a bug? It seems very odd to me, because the lightmap bakes just fine on GPU in the absence of light probes. I'm using Unity 2019.18.2f1 with HDRP 6.9.2 on Windows 10.
     
  2. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    486
    The GPU lightmapper has some bugs and GPU memory restrictions. What I get from QA is update to the latest and best GPU lightmapper version, which is only for 2020.1. So either upgrade or try to lower the quality of the rendering.
     
  3. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    Okay... makes sense, given that it's in "preview". But it still could at least print a message in the console indicating why Unity reverted to the CPU mapper.

    Thanks for your answer. I hope the lighting issues improve once 2020.1 is out, also with respect to realtime GI.
     
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    486
    Doesn't it show a warning in your Unity console? For me everytime it switches back to CPU is due to "Out of VRAM".
     
  5. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    Nope, nothing there. Which is why I was so confused. I'm running on a GeForce 980ti, not exactly the latest and greatest but still a halfway decent GPU - that is, at the times Unity actually cares to use it for lightmapping ;)
     
  6. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    486
    Well, I'm also fairly limited with the GPU lightmapper on 2019.3.0f5, using a RTX 2060.
    Didn't even dare to bake huge scenes with it.
     
  7. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    My scene is also not all that complex. It has some "dense" meshes in it, meaning ~30k triangles, but they're all static. This is the first time I'm looking into lighting in Unity, and I must admit that I'm a little disappointed: it's hard to control and "get right", nearly impossible to debug the individual influences that compose the final picture and the performance of the CPU lightmapper is really poor, which has me waiting for an end result I'm not going to like a lot of the time. Enlighten being removed from the picture without a proper replacement doesn't help either. And that's even before taking into account HDRP / URP / builtin renderer differences. It's a mess, really. I hope Unity manages to get out of this hole, fast.
     
  8. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    Contrary to my earlier comment, I DO see a message in the console when baking lightmaps - I just didn't realize it's comming from the lightmapper. It says:

    "Selected texture format 'ARGB 16 bit' for platform 'DefaultTexturePlatform' is not valid with the current texture type 'Default'."

    Well... whatever this means, I'm sure it makes sense to somebody ^_^'
     
  9. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    486
    It depends on the quality settings in lightmapper. If you want to have high enough samples and lightmap size you have to accept the fact that you need a fairly super computer. Otherwise you really spent a lot of time on waiting for the renderer and making lighting changes again and again.
    I also faced that some time ago, and regarding the fact that Unity gets each update slower and slower, and is demanding more and more ressources, the decision to upgrade all devices came very fast. Plus an extra buffer in case for some additional bugs that makes everything additional slower. Enlighten is only supported if the project was created in version up to 2019.1. I think. But Enlighten is also very horrible if you do not carefully optimize your scene for that. That means exclude small objects from GI contribution and adjust the texel size. So either wait if Unity come up with a new Realtime GI or stick to Baked.
     
    Last edited: Jan 20, 2020
  10. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    That sounds like a real pain as well... Like I said before, first time looking into lighting here. I imagined that it would be a lot simpler to be honest, with all the physics-based workflows, we still have to worry about number of light bounces and indirect light strength and other even more arcane parameters - plus big baking times. Coming from Blender, their new Eevee renderer handles lighting pretty smoothly and in real-time, even while editing the scene. And things don't fall apart when you update the program. I don't know if things are better in Unreal or other engines, but what I'm seeing right now in Unity is a little disappointing in certain ways.
     
  11. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    486
    It depends on the project. If you want to have indirect light bounce from every light sources, then yes, it is time-consuming, placing all the light probes. And even harder with Realtime GI with Enlighten, which is going to be dropped by Unity. The new Realtime GI they announced will have features like automatic light probe placements, I think.

    But at the moment you are really limited because of the gap year(s) Unity has, GPU lightmapper is in preview as well as Realtime Raytracing and Enlighten is dropped, leaving you with CPU lightmapper or older Unity versions or third party assets. (Which I do not want to advertise here.)

    As for Unreal, their Realtime Raytracing is also still in preview. And if you want to use Enlighten with Unreal, you have to make an own contract with the company who is now the owner of it. (Which really sucks for indies, art universities and small start-ups with tight budget ...)
    At least if you use Unity, you get Enlighten for free but it will be no longer be supported.

    So all in all lighting is expensive in time, work and MONEY.
     
    Last edited: Jan 20, 2020
  12. Alan47

    Alan47

    Joined:
    Mar 5, 2011
    Posts:
    148
    That seems to sum it up, yeah. I'm just a hobbyist / game-dev enthusiast, which means zero budget and very scarce resources overall. I'll continue tinkering with what I have, from time to time I do see improvements. I hope to carry over my overall lighting setup and post processing settings to other scenes once I get it working.

    Thanks for the advice / insights!
     
  13. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    94
    I have RTX 2070, I cannot use more than 2 "bounces" for GPU lightmapper. Then it works O.K.
     
  14. hertz-rat

    hertz-rat

    Joined:
    Nov 3, 2019
    Posts:
    71
    "It depends on the quality settings in lightmapper."

    This is happening to me even though I'm using a GTX1080 with 8GB VRAM.

    Could you explain a little more what settings are affecting this? IIRC, my only non-default setting is shadow size under directional lights (set to 2048, otherwise it doesn't look that great). I'm afraid I just don't know much about how the system works.

    (A favourite article or tutorial would be appreciated too!)
     
  15. xDenny8

    xDenny8

    Joined:
    Feb 12, 2017
    Posts:
    13
    if you have problem with switching back to CPU lightmapper while using Light probes then delete all your light probe groups except for one.. and extend that one across your entire level (as you probably did with multiple groups).. there will be no difference for you as all light probes are connected anyway... so you'll will end up with one massive light probes group but it will work with GPU lightmapper without problems
     
    Gametyme likes this.
unityunity