Search Unity

Question How to reuse lightmaps on different scenes that use the same scenario

Discussion in 'Global Illumination' started by Serge144, Oct 30, 2022.

  1. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    65
    I have multiple scenes which use the exact same scenario. (These are basically different levels where some gameobjects have different configuration, but all the level use the same scenario)

    All I wanted to do is to apply the same lightmaps of one scene to all the other scenes so I dont have to bake for each scene which will increase even more the size.

    Thanks.

    EDIT:
    By same scenario I mean same geometry & same baked light.
     
    Last edited: Oct 31, 2022
  2. r9shackleford

    r9shackleford

    Joined:
    Jul 23, 2019
    Posts:
    23
    We do something similar by isolating all static geometry to its own scene and using multiple additive scenes. The dynamic objects in it change quite a bit, which are on their own separate scenes with an indeterminate number of those dynamic scenes active at any one time. So our setup is like this:
    NAME_Dynamic_SceneN
    NAME_Dynamic_Scene(N+1)
    ...
    NAME_Lighting_Scene
    NAME_Static_Scene

    It sounds like this could work for your problem? Hope that helps.
     
    Serge144 likes this.
  3. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Not sure what you mean by "exactly the same scenario". I'll assume you mean same geometry and same (baked) lighting. If that is not the case, please clarify :).

    I'd recommend something like what r9shackleford is saying. However it can be even simpler than their setup assuming that both geometry and lighting are always the same.

    You can create a scene called World (or something like that) and put everything static and all baked lights in there. Open this scene and bake it.

    Then you can have any number of scenes called Level1, Level2, etc. which additively loads World. In addition to World, these LevelX can each add any/include anything else like the game objects with particular configurations, which you mention. This allows the LevelX scenes to be different while reusing the same shared World.

    If you are looking for something more advanced, you may want to have a look at https://github.com/laurenth-personal/lightmap-switching-tool and its source code. I should note that this library is not an official Unity library, but you can hopefully find some good inspiration in there.

    I hope that helps.
     
    Serge144 likes this.
  4. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    65