Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

LightmapSnapshot needed by player / runtime?

Discussion in 'Global Illumination' started by idunlop_oefun, Mar 10, 2015.

  1. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    To save space we don't commit out LightmapSnapshot files to our git repo. So we're seeing this issue on Unity Cloud builds. However, this issue can be easily repro'd in the editor.

    I have a scene which when loaded using LoadLevel(), will fail to associate the baked reflection probe texture to the reflection probe. I can see this in the editor when I inspect the reflection probe. There is a message on the preview; it says "Reflection Probe not baked yet".

    If I perform the same test with the LightmapSnapshot file present the loaded scene behaves as expected.

    So, is the LightmapSnapshot actually needed or is this a bug?

    Thanks!
     
  2. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    The lightmap data asset is needed in the Editor to be able to map all the baked data to instances (objects, reflection probes, etc.) in the scene*. The mapping is resolved when the scene is loaded in the Editor and all that data is simply serialized in the scene, but only when the player is built. In the Editor it's resolved every time anew.

    That means that the scene is not made dirty when the bake finishes. :)

    So if you're not using the continuous mode (and hence you get the asset with lightmap data) you need to submit that to your VCS.
    If you're using the continuous mode however (so you don't get any assets when the bake finishes) then each of your team members will need to bake the lighting from scratch. Once you make a small change that affects lighting the GI data will be rebuilt incrementally for you and similarly for others that grabbed the new changes.

    *) this asset also stores all the Enlighten files needed for realtime GI
     
    idunlop_oefun likes this.
  3. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba Thanks for that explanation. That confirms a lot of what I had already pieced together. Could the mapping be stored in a separate file and the remainder of the LightmapSnapshot.asset moved to the library / cache? Would that reduce the size of the file we need to commit?
     
  4. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    No, not really as you need both the mapping and the GI data to be able to have GI. ;)

    That said, we will cut down the size of the lightmap data soon: http://forum.unity3d.com/threads/lightmap-snapshot-buildsize.309901/#post-2027837

    It's of course possible that we're storing too much data for your use case. Could you describe it better? Do you have only baked lighting or a mix of realtime GI and baked GI, etc.?
     
  5. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba In this particular case it's only baked lightning. I'm also trying to solve an issue regarding the git repo size and rethinking whether we should be using git or plasticscm. For a particular level the LightmapSnapshot is over 550MB.

    So, cutting down the size of this file would help (a lot).
     
  6. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    Do you have "Realtime GI" deselected in the Lighting window?
     
  7. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba Ambient Gl is set to 'Baked'.
     
  8. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba Actually, sorry - looked at the wrong scene. Just switched the large one to baked and it dropped the file to 366MB - so that is better, but still fairly large. Perhaps in combination with these new optimizations I'll get this down to a reasonable size. Thanks again!
     
  9. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    If you have realtime GI disabled the lightmap data asset should be very small (as it should only contain various mappings and baked light probes coefficients). Could you perhaps submit your project, so that we can see what's up?
     
  10. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba Sorry for the late response. I've submitted a test scene that shows the issue -
    (Case 683343). The LightmapSnapshot.asset is 366MB in this test case.
     
  11. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba Ok, not sure why I missed this before, but my previous comment about Ambient GI being set to 'baked' is not the whole story. As per your original statement I now uncheck the 'Precomputed Realtime GI' and that does the trick. My lightmapsnapshot.asset file is now 185KB (down from 366KB).
     
  12. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
    @Kuba @David Berger The continuing saga.... ok, so I now have tiny LightmapSnapshot.asset files when I disable the realtime GI component. The new issue is that when I build through UCB the lighting is missing. None of the light maps or cube maps are hooked up (i.e. everything looks dark / unlit). FWIW, in the editor or building locally on iOS everything works as expected. So this is a UCB issue.
     
  13. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    Could you submit a bug report on the UCB issue?
     
  14. idunlop_oefun

    idunlop_oefun

    Joined:
    Aug 31, 2010
    Posts:
    240
  15. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    416
    The other thread clarifies some repro steps, thanks!

    I responded there...