Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Different Lighting Setups in single scene

Discussion in 'Global Illumination' started by jashan, Aug 18, 2015.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Is there a way to switch out the complete lighting setup during runtime?

    Basically, what I want to achieve is having different levels in a single scene to avoid loading times after startup (this is a VR game, so the hiccups even when using LoadLevelAsync are not acceptable - a longer startup time is fine, however). There's also quite a bit of stuff that's shared between levels, so from that perspective it's also nice to keep it all in one single scene.

    In the level, there are root game objects Level-00, Level-01, Level-02 and so on which I can activate / deactivate. I've tried both using only Precomputed Realtime GI and this plus Baked GI (and switching out the lightmaps). I've also tried both Ambient GI = Realtime and Ambient GI = Baked.

    I can bake one level at a time, copy the generated assets to separate folders and then switch out the skyboxes and lightmaps during runtime. That part works really fine. However, it seems that there's still some lighting information stored in another place (probably LightmapSnapshot) so that the lighting of the last bake is kept for all levels.

    I'm using Unity 5.2 (beta6, later today I'll switch to RC1). Is there any way to achieve what I want or do I have to fall back to loading each level separately (causing a pretty annoying hiccup when the new level is loaded even when using LoadLevelAsync)?
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hm ... it gets worse: Even when I do LoadLevelAdditiveAsync, it doesn't replace the lighting and/or Skybox :-(
     
  3. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    Why you do that manually? does not occlusion culling help you at all if you bake it?
     
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    The levels are all in the same area, so if I'd keep them, stuff would be on top of other stuff. I could, of course, distribute things to different areas - but that wouldn't make a difference for the problem I'm trying to solve. What I did now was put DontDestroyOnLoad on every object of the main scene, pull all "environment stuff" out into separate scenes and load those with LoadLevelAsync (not "Additive").

    That does work pretty well for my scenario, even though it's a terrible hack.