Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved OpenCL-Errors while baking lightmaps with Progressive GPU Lightmapper

Discussion in 'Global Illumination' started by Deleted User, Nov 11, 2020.

  1. Deleted User

    Deleted User

    Guest

    I'm trying to bake lightmaps for a more complex scene with the Progressive GPU Lightmapper. The problem is, that it almost always falls back to the CPU Lightmapper, after throwing OpenCL-Errors:

    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_OUT_OF_RESOURCES
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_OUT_OF_RESOURCES error executing CL_COMMAND_READ_BUFFER on GeForce RTX 2060 (Device 0).
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_OUT_OF_RESOURCES error executing clFlush on GeForce RTX 2060 (Device 0).
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_INVALID_EVENT
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: IntersectionApi::Commit failure: likely out of GPU resources.
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_INVALID_VALUE
    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_INVALID_BUFFER_SIZE

    I suspected that the graphic card's VRAM running low, but while monitoring it during a bake attempt it never went past ~4GB of 6GB.
    If I finish the bake via the CPU Lightmapper it creates 14 texture (twelve 1024px, one 512px, one 128px), with a total size of ~35MB.

    All bake attempts are made with these settings:
    lightmapping_settings.png
    The strangest thing is, that the bake on the GPU works in some rare cases for no obvious reason (lightmapper settings are the same, no changes to the scene).
     
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    It sounds exactly like you suspect, it is running out of GPU memory. Which version are you using? Can you try on latest 2020.2 please? If that doesn't work please attach the editor.log file. Thanks
     
  3. Deleted User

    Deleted User

    Guest

    Thanks for your quick reply. I'm currently importing the project in 2020.2 for testing, but it will take some time. I'll attach the Editor.log for now.
     

    Attached Files:

    Last edited by a moderator: Nov 11, 2020
  4. Deleted User

    Deleted User

    Guest

    The problem seems to be fixed as far as we can tell (at least for now). Thanks KEngelsoft, your suggestion to try Unity 2020.2 was spot on. It seems you were correct, and the problem was, that too little VRAM remained for the lightmapping textures. Although it's strange since my GPU monitor didn't show high memory usage...

    In 2020.2 the GPU Lightmapper disables the progressive updates automatically if it would need more VRAM than available. Disabling the progressive updates in early Unity versions manually fixes the problem there as well (at least for our case).
     
    KEngelstoft likes this.
  5. subhomukh1407

    subhomukh1407

    Joined:
    Aug 2, 2018
    Posts:
    7
    I have updated with Unity 2020.2 1st time it is done with a small model but when I tried with terrain it gives the error I am not sure why it is happening. please suggest any another way I am using GTX1050Ti 4GB.