Search Unity

Allocate more video memory? Is there anyway to force this

Discussion in 'Global Illumination' started by CosmosBear, Apr 24, 2020.

  1. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    67
    TL;DR: How to get more gpu memory, need an indication at how much we use before busting and if unity can't help with 1 at least have something to support multi scenes setup.

    So I work my environements like a good environement artist that I am (some gigantic house), then bake and at some point I get this error:
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: Max allocation size supported by this device is 1.50 GB. 2.58 GB requested.

    Unity then revert back to progressive cpu wich is terrible because it take like 10 hours instead of 20 minutes.
    Of course the classic way to fix is reduce your sample, reduce the light map size...

    Then you reach the point where you don't want your lighting to looks like total garbage so you can close the Game and editor view windows and even reduce Texture quality (project setting/quality)
    yes it help and no, it do not reduce the lightmap quality (just don't forget to change it back to full res afterward)

    BUT THEN... you reach a point that this is not enough so... time to split the scene in two scenes (with all the problems that go with it). Then three scenes, then four...

    I have a RTX2060 with like 6 GB GDDR6 memory, I'm not sure why I only get 1.50 GB supported, I guess it's a driver related thing.

    Anyway these are the crucial questions:

    1- Is there any way to allocate moar memory? In unity or windows, if not, can Unity do anything about it?

    2- Is there any indication of how much memory you are currently using, instead of just displaying it when you bust? (Press Generate Lightmap get a message "you are at 1.25GB Max allocation size supported by this device is 1.50 GB, 0.25GB until apocalypse...
    if not, can Unity do anything about it?

    3- Any tool that would support multi scenes setup would be great. My current workflow go like this I have 5 scenes:
    Scene 1: Anything character related, and non art related stuff
    Secne 2: Outside environement stuff
    Scene 3: Inside environement A
    Scene 4: Inside environement B
    Scene 5: Inside environement C

    Then I bake Outside alone, then same with Inside Environnements but of course I need a some sort of mesh shell to occlude lights from goint trough the backface of the inside walls, but I need to hide it in play mode, that and the VolumeProfile and directionnal temporary used... then I need to load each scene and bake each reflection probes then I shot myself in the head because I need to do it again with each scene set as active because Light prbes need to be splitted in each scenes because you can't just put everything lightmap static, you need to use the lightprobe system or else you will bust you memory before reaching this point thus having 8 scenes instead of 5... so yeah


    So is there a magic tool that I missed? if not, can Unity do anything about it?

    Sorry for the wall of text and my terrible engrish but I think I'm asking good questions here please don't let this post die.
     
  2. ADufay

    ADufay

    Unity Technologies

    Joined:
    Jan 2, 2020
    Posts:
    30
    Hi CosmosBear,
    The issue you are facing is indeed driver related. It's not that you don't have enough memory to fit what unity needs to
    bake on your GPU but the problem is that your OpenCL driver is limiting the maximum size per buffer.

    You can check the maximum size allowed by searching the value of CL_DEVICE_MAX_MEM_ALLOC_SIZE which is around 1.50GB for your RTX 2060 (see: https://compubench.com/device.jsp?benchmark=compu20&D=NVIDIA+GeForce+RTX+2060&testgroup=info)

    Unfortunately no, there is no way to bypass this driver limitation.

    You can see the currently used memory using the Windows task manager (Go to Performance -> GPU).

    Reducing memory consumption is our main focus for the GPULighmapper currently, and some optimizations as well as a tiling solution (no setup required, fully automatic) will be soon available.
    For now, to address your issue you can reduce the memory pressure by lowering the Max Lightmap size and/or reducing the number of antialiasing samples.
    You can change the antialising for the lightmapper by creating a Lightmap Parameters (Lighting -> Lightmapping Settings -> Lightmap Parameters) and then go to Baked GI Antialiasing samples.

    I hope that helps !
     
    MajorMegaChris and Slave1 like this.
  3. o-stanek

    o-stanek

    Joined:
    Dec 26, 2015
    Posts:
    1
    My Nvidia 3070 Ti is able to address 8GB VRAM, it is possible to use my Intel UHD? Intel should be able to address shared 15,9GB. And it is possible use this shared VRAM by Nvidia?