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

Light probes issue with additive scenes loading

Discussion in '5.5 Beta' started by camel82106, Nov 6, 2016.

  1. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Hello,
    I'm using realtime GI. And I'm using light probes for terrain trees. Baked GI is disabled

    I have this setup for additive scenes loading:
    manager scene - loaded at start (doesn't contain objects needed for lighting)
    map scene 1, 2 - loaded additively contains basically whole level (separate map scene for every map)
    map base scene 1, 2 - contains player, directional light, sky = basically potentially shared thing between all maps

    Now how I build lighting:
    Approach 1:
    In editor load additively manager scene + map scene 1 + map base scene 1. Build precomputed realtime GI.
    This works, lights probes are working.

    Approach 2:
    In editor load map scene 1 + map base scene 1. Build precomputed realtime GI.
    Light probes are black when testing it. It looks like without scene that is not loaded additively it doesn't work.

    Problem with approach 1 is that if I would like to support more than one map.
    I would need to build manager scene + map scene 2 + map base scene 2. But this will remove built lighting for map 1. Even if copy it back. Manager scene contains reference to lighting assets. So only one map will be working.

    So what is recommended way to do this?
    I always though that it's recommended to use manager scene as feature replacing don't destroy on load for managers. That means that you need to load manager scene before map scenes.

    Building all scenes at once? This would need to offset map objects in world so they will not influence each other. And it's really bad solution regarding scalability? If I would like to add 31st map I need to rebuild lighting for all maps?

    Is it something that Unity is aware of?

    Best regards
    Peter
     
  2. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Regarding my problem with additive loading of scenes and not working light probes.
    After few days of agony I have found solution.
    So before I had manager scene, menu scene. map 1 scene, map 2 scene for example.
    Manager scene was loaded on start.
    Than additively loaded menu scene and finally map 1 scene for example.
    Problem was that if I have calculated realtime GI for map 1 scene alone.
    Light probes weren't working.
    If I have calculatated realtime GI for manager scene + map 1 scene it was...
    But that wasn't an option as you want to have x maps working... and if you would calculate realtime GI for manager scene + map scene 2. Map scene 1 will stop working.
    What I have done is simple reverting to unrecommended approach with don't destroy on load.
    So I have just added parent root game objects for all objects in manager scene.
    Build lighting separately for map scene 1 and 2
    And now I'm loading map scene 1 and 2 not additively but as single.
    And light probes will catch on...
    It basically eliminates purpose of additive loading to some degree, but...

    Any reaction from Unity, what is recommended to do? Is it bug?
     
  3. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @camel82106,

    There is a known issue with additive scene loading and light probes. Basically, light probes data overwrites the lighting data of next scene when scenes are loaded using additive mode. For now, the workaround is to manually build the lighting. Sorry for the inconvenience but you can check the status of this bug in issuetracker and vote if you want us to prioritize the fix: https://issuetracker.unity3d.com/is...-use-light-probe-data-from-first-loaded-scene

    Thanks!
     
    Last edited: Nov 11, 2016
  4. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Thanks, voted. Although I really hope that critical issue like this is not prioritized based on amount of votes...

    I can easily imagine how many people are experiencing this problem. And they don't know why or what is wrong. And they are not able to grasp it or even vote for it, which results in creation of confusion and disbelief in engine.

    Best regards
    Peter
     
  5. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    I would hope this would just get fixed asap...
     
    camel82106 and JonSWEDEN like this.
  6. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hi @camel82106 and @hoesterey,

    While we're working on the fix, you can alternatively use a workaround solution. You can initially clear the baked light probes data after loading a new scene:

    Code (CSharp):
    1. SphericalHarmonicsL2[] bakedProbes = LightmapSettings.lightProbes.bakedProbes;
    2. int probeCount = LightmapSettings.lightProbes.count;
    3.        
    4. // Clear all probes
    5. for (int i = 0; i < probeCount; i++)
    6.     bakedProbes[i].Clear();
    This script still requires at least one light probe in the new scene. For more information: https://docs.unity3d.com/ScriptReference/LightProbes-bakedProbes.html
     
  7. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Heya
    This sounds interesting. I have a similar problem where I need to bake multiple scenes seperatly as the objects overlap.

    So given your solution can I:
    Have a master scene with a root game object for all sub objects. Set don't destroy on load.

    Load scene 1 that has previously baked gi and light probes also set to don't destroy on load.

    Load scene 2 that has previously baked go and light probes also set to don't destroy on load.

    When all the scenes are loaded the 2.light probe groups work together?!
     
  8. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Hi,
    Will clearing the baked prob data cause unity to recalculate and use probes from both scenes?
     
  9. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    977
    I'm sorry, how does this work around work?

    This is a small test project with manually built lighting in both scenes. But as soon as a scene is loaded additively, light probes stop working.



    https://gfycat.com/RemorsefulHarshAmericangoldfinch
     
    sanmn19 likes this.