Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

GI not following scene when using SceneManager.LoadSceneAsync

Discussion in '5.4 Beta' started by olavrv, Jun 15, 2016.

  1. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    We have a scene#1 where we use the function below to load scene#2 into scene#1:

    SceneManager.LoadSceneAsync( scene#2, LoadSceneMode.Additive );

    When we copy the content of scene#2 into scene#1 manually, it works - but when using the function above it seems like the realtime GI does not follow scene#2 into scene#1 (looks like it has no realtime GI).

    Any input and help on this issue is greatly appriciated.
     
  2. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Have you tried setting the newly loaded scene as the active scene? I don't know if that works with GI, but works at least with ambient lighting.
     
  3. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Just tried that, but doesn't seem to make a difference..
     
  4. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    It seems like the "Precomputated Realtime GI" data is not included when loading scene#2 into scene#1
     
  5. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    I've been following this issue quite closely.
    Unfortunately this has been on ongoing issue with 5.x. There's quite a few threads on the forum about it.

    https://www.google.co.uk/webhp?sour...load+scene+additive+gi+site:forum.unity3d.com

    As far as I understand it and through my own testing the outstanding issues are with build players. Standalone and Mobile.
    When a scene loaded with LoadSceneMode.Additive and then activated with SceneManager.SetActiveScene() the GI is not rendered correctly. Depending on your lighting settings the result is usually a completed washed out scene.

    An example can be seen on this thread:
    http://forum.unity3d.com/threads/gi...dditive-rendering-issues.310452/#post-2708573

    Unfortunately Unity devs aren't very forth coming so we're in the dark on this one.
    There's a "Fixed" issue #659042 on the tracker but as the comments on it suggest, it's only fixed in the Editor.
    https://issuetracker.unity3d.com/issues/gi-is-broken-if-loadleveladditive-is-used
     
    Last edited: Jul 13, 2016
  6. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Hey @olavrv,
    Could you specify if you're doing that in the Editor or in the player? If in the Editor, is 'Auto' enabled in the lighting panel in the scene that you're loading additively?

    If that's the case then currently realtime GI for the scene that is loaded additively will be missing.* We'll be fixing that soon.
    Workaround: disable 'Auto' in the scene that you want to load and build the lighting for it manually.

    Cheers!

    *) Some background on why that is:
    when in the 'Auto' mode Unity continuously looks at the contents of the scene and makes sure that lighting is up to date. The results are only stored in the cache and when that scene is loaded Unity spawns jobs to generate the needed data and quickly notices that this data is already in the cache, loads that and patches the scene with results.
    However, when one enters the play mode in another scene and tries to load the first scene additively, that process will not run and the scene that is loaded will not be patched with appropriate data.
    The fix is not to run that process when in play mode though. Instead we'll always create the lighting data asset (so the same thing that is written to the Assets folder when 'Auto' is off) and will store that in the cache. That will allow scenes that use 'Auto' to get lighting instantly when they're loaded, regardless if they're open by double clicking the name or loading the scene additively in play mode.
     
  7. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Hi, We now build the dynamic GI in the scenes that we load (got this tip from another guy working at Unity), and then it works perfectly.

    To load the scene we use the following:

    asyncOp = SceneManager.LoadSceneAsync( sceneName, LoadSceneMode.Additive );
     
  8. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    @Kuba @olavrv issue with light maps has been fixed in 5.3.5p2