Search Unity

Light Probes and additive scene loading

Discussion in 'Editor & General Support' started by xiotex, May 21, 2012.

  1. xiotex

    xiotex

    Joined:
    Sep 26, 2010
    Posts:
    37
    We have a scene that contains a mesh that is light mapped and we have inserted light probes into it. The light probes work in that scene but when we then additively load that scene into another scene the light map still works but the light probes don't.

    Does anyone know if there is an issue using light probes in a scene that is additively added to another scene at run-time?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Lightprobes, lightmaps and occlusion culling don't support additive loading. They are bound to their scene and only load correctly out of the box when done through LoadLevel / LoadLevelAsync

    as such you would need them to be present in the core scene and only additive load the additional visual content
     
    Last edited: May 23, 2012
  3. xiotex

    xiotex

    Joined:
    Sep 26, 2010
    Posts:
    37
    Can you clarify upon this because we have a scene called 'level_01' that is loaded like this:

    Application.LoadLevelAdditive("Level_01");

    And that contains geometry that is light mapped and has light probes and the light probes work fine if Level_01 is the core scene but as soon as we load it additively through that above line into the 'real' core scene they stop working.

    Does this also apply to other things such as controlled shader render order through the 'queue' tag as I'm also seeing issues there when loading a scene additively.

    This is very worrying for us because the game I am working on is being developed in a team of 6 people and we got around the version control issue by breaking the core scene into additive scenes so that we can all work in parallel without fear of overwriting each others work.
     
    Last edited: May 23, 2012
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    It does not apply to other things.
    Only stuff thats baked 'per scene' and not 'per object' is affected by this limitation which are Lightmaps, Light Probes and Occlusion Culling due to Unitys incapability to merge per scene properties.

    All these 3 things will only load into the scene when you use LoadLevel or LoadLevelAsync (by error originally additive in first posting, sorry on the confusion). When you try to use them with Additive loading they will be stripped out because Unity is not capable of 'merging' these per scene informations when you have 2 concurrent scenes (which is the case with additive loading).

    What you hence need to do is bake light probes and occlusion inside the core scene already and then strip out the geometry etc from it to load additively later on. Lightmaps can be controlled programmatically and hence be present in additive scenes if YOU handle their loading and assignement. I don't think thats possible for light probes right now and its for granted not possible for Occlusion Culling
     
  5. xiotex

    xiotex

    Joined:
    Sep 26, 2010
    Posts:
    37
    Okay, thanks for clearing that up.
     
  6. RocketPop-Games

    RocketPop-Games

    Joined:
    Feb 26, 2012
    Posts:
    11
    This is a bug that needs to be addressed IMO. Having a feature set be so non-orthogonal (and with no documentation on when feature cases break) makes it easy to assume something "should work" and burn a lot of time... As you might guess - I had the same issue :)

    The way i worked around it might not work for you but here goes. I have a probe fixer script in what I guess would be your core scene that I MANUALLY assign all the references to the light probe data from each of the separately baked scenes. Just drag each of the sublevel "lightprobes" object under the lightmap folder into some script references. Then you can modify lightmapsettings.lightprobes at runtime with any given reference to the stored lightprobes. Hope that's clear. Note that this is not an additive thing, it's a swap operation - the old lightprobe for "core" is removed and swapped out for the data from some sublvl. I had mine overlap a bit. Kind of like how I used to hide level portals back in the day :) There's another bad bug that happens to me on iOS that "Mobile/Diffuse" shaders in the additively loaded scenes DO NOT work with lightmaps after the load. I had to go over my entire scene at load and replace them with regular "Diffuse" shaders - then it works. Giant pain in the butt. But I had to have it work so there you are ;)
     
  7. NTDC-DEV

    NTDC-DEV

    Joined:
    Jul 22, 2010
    Posts:
    593
    Actually... lightmaps works just fine with LoadSceneAdditive. Had some quirks before 3.5 where indexes would not reset, but other than that its perfectly fine.

    OcclusionCulling is indeed not supported by LoadSceneAdditive. (which... I will state for a hundred time, is completely useless in streamed scenes which is a common approach for creating huge worlds... thus huge projects cannot benefit from Umbra. sigh)
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Oh thats good to know :) Not that it was impossible before, just not 'out of the box'

    Have not checked it on 3.5 so far actually as the project that required and requires is remained on 3.4 due to some problems we had and couldn't overcome in reasonable time as it was in the final stage prior release.