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

Bake time is very long when baking LODS with PLM

Discussion in 'Global Illumination' started by jStinson, Sep 7, 2018.

  1. jStinson

    jStinson

    Joined:
    May 9, 2017
    Posts:
    20
    Unity Version: 2018.2.5f1

    Issue: Scene has a terrain and some static props. The props have 4 LODs. The bake takes about 30 seconds with only the terrain and props LOD 0 visible / static. The bake time shoots up to 5+ hours with LOD 0 and LOD 1 visible / static. I left a bake overnight with terrain and all LOD levels visible / static that took just over 13 hours. The props with all LODs and no terrain bakes in about 8 minutes. Is this expected behavior?

    Lighting Settings and Directional Light Settings attached, but they are scene defaults. lighting_settings.PNG
    light_settings.PNG
     
  2. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    411
    Hey @jStinson,
    This is currently a known issue that has to do with how we render LODs in a progressive manner (there are a lot of BVH updates that kill the performance).
    The currently planned and in progress work:
    1. fix LOD viewport calculations, as currently some LOD setups might never finish baking
    2. improve the speed of rendering just LOD0s
    3. ship a script that allows for setting up LOD projection (where lower LODs just point to the part of the lightmap occupied by LOD0, assuming their UVs match)
    4. release LOD projection as a built-in feature
    I hope to have 1., 2. and 3. done for 2018.3.
    4. needs to tie in with other refactoring on the per renderer lightmapping setup that we're doing, so that will come a bit later (early in the 2019.2 cycle most likely).
     
  3. jStinson

    jStinson

    Joined:
    May 9, 2017
    Posts:
    20
    Hi @Kuba , thanks for the reply. The LOD projection would work well for us since we use custom lightmap UVs. We're able to work around the issue for the moment, but I'm glad to hear it's being worked on.
     
  4. helgarddebarros

    helgarddebarros

    Joined:
    May 10, 2014
    Posts:
    157
    Any news or details or tutorials on this? I have searched and find very little information.
     
  5. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,239
    LOD baking is done at full speed with GPU lightmapper in 2020.1 and later. The algorithm was ported to CPU lightmapper too for 2020.2 IIRC.
     
  6. helgarddebarros

    helgarddebarros

    Joined:
    May 10, 2014
    Posts:
    157
    Does this bake one lightmap to use on all LOD's, or still bake a separate lightmap for each LOD?
     
  7. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    168
    Each lod instance will get its own space in the lightmap, but they can still be within the same lightmap texture.

    The LOD improvements to the CPU lightmapper are already in 2020.1. Whereas the algorithm between the CPU and GPU lightmapper are not the same due to different base technologies, the observable results should be mostly identical.
     
    helgarddebarros likes this.
  8. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    51
    If I'm understanding correctly, for Progressive Lightmapper the Lightmap from LOD0 can be projected onto the higher LOD levels? Presumably we cannot use the Lightmap UV generator within Unity to do this as the secondary UVs would be too different between the LOD meshes. Actually, now that I think of it, won't the UVs be different in most cases no matter where they're made, custom or not, since the mesh is different between the various LOD levels? I understand that it's going to depend on the UV islands, but I thought it's always best to separate (lightmap) UV mostly by flat surfaces which usually require very little geometry anyways - anything more than, say 2 degrees, should be separated?
     
  9. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,239
    Projecting LOD0 so higher LODs use LOD0's lightmap is possible but it isn't a built-in feature. For 2020.1 and later, light baking with LODs are happening at full speed so the projection should mainly be considered for memory optimization purposes or if you are stuck on an older version.

    If you want to experiment with LOD projection, see the attached example code. Beware, it is not production ready, and I am not able to provide any support. It is provided as is, for inspiration only.
     

    Attached Files:

unityunity