Search Unity

Question Are all lightmaps associated with the currently loaded scenes always in memory?

Discussion in 'Global Illumination' started by Bezoro, Mar 19, 2023.

  1. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    For the life of me I cant find a definitive answer on this.

    I am trying to use as few scenes as possible for my projects going forward in order to try to simplify the workflow.
    Ideally I would only have a single scene loaded (I would probably need a couple, but I'd like to have as few as possible) and the entire game would use a custom streaming solution that would stream the prefabs that make up the world dynamically.

    Now, I would very much like to use baked lighting (multiple baked scenarios in fact, that would blend between themselves based on the time of day), but if all lightmaps associated with the scene are always loaded that could become an issue when it comes to memory usage.
    I looked into mipmap streaming for lightmaps hoping that it could help, but information on how exactly it works is also sparse.

    What I am hoping to achieve is that as I stream the world in and out (again, single scene, many prefabs) Unity can figure out which lightmaps should be loaded at that given moment based on what is currently loaded in the scene.
    If that is too much to ask then at least some API that i can use to load the lightmaps as necessary. But what I found on any sort of API related to lightmaps is painfully limited, so I don't think I can have much control over them and am at Unity's mercy on that one.

    So, to reiterate, are all lightmaps associated with the currently loaded scenes always in memory? Because if so then my ideal workflow is probably dead in the water and I will have to make do with the clunky additive scene workflow everyone uses.
     
  2. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    Hmm, guess I will have to figure this out the hard way.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    You always have to check, because there could be bugs or undocumented changes, but the answer should be: "Yes".

    To save on memory you could implement something like this:
    but it involves a lot of custom work.
     
  4. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    Interesting approach, thanks for the input.