Search Unity

Lightmaps with additive scenes

Discussion in 'General Graphics' started by mm1982, Jul 28, 2017.

  1. mm1982

    mm1982

    Joined:
    Apr 28, 2015
    Posts:
    35
    Hi,

    I'm having issues with lightmaps for separate scenes loaded additively.

    My first scene is the "bootstrap" scene which has no geometry/lights, it loads the camera and other necessary things. Then I load additional scenes additively for the different parts of the world.

    Each scene I've baked lighting separately. The lightmap looks fine, but only if that scene is set as the active scene. Here are screenshots of what a sample scene looks like when the bootstrap scene is the active scene, and when the other scene is set as active.


    I'm not sure what is going on here... can anyone help point me in the right direction? I should be able to do what I'm doing, correct? Baking scenes separately, and load them additively as needed?

    This is in Unity 2017.1 as well as in 5.6

    Thanks for the help
     
  2. scvnathan

    scvnathan

    Joined:
    Apr 29, 2016
    Posts:
    75
    I haven't tried this, but on a recent Unity blog post they offered a potential solution:

     
    harpiagamesstudio likes this.
  3. mm1982

    mm1982

    Joined:
    Apr 28, 2015
    Posts:
    35
    Thanks, do you have the link to the blog post?

    I am making a game that will be one continuous map, so will load/unload different parts of the map as the player approaches them. I had no notions up to now that this would be problematic. The creators of Firewatch (also made in Unity) use the approach of load/unload portal triggers for streaming in scenes as the player triggers them. Is it feasible they would be using the above approach? Is it not possible to individually bake each scene and load them additively in any order/combination later?
     
  4. scvnathan

    scvnathan

    Joined:
    Apr 29, 2016
    Posts:
    75
  5. mm1982

    mm1982

    Joined:
    Apr 28, 2015
    Posts:
    35
    Thanks for the help. I think I may need to reconsider my strategy then, and look at alternatives
     
  6. richrdcollinge

    richrdcollinge

    Joined:
    Oct 23, 2014
    Posts:
    1
    I've been having the same problem with a VR project I've been working on.

    There is a master player scene with camera etc and sub scenes are loaded as the player progresses. The problem has been that certain scenes are vastly different in the lighting so it wasn't feasible to load all open scenes and do a bake.

    So the best solution was to bake each scene separately, then once the scene is loaded in I use a scene controller to set that scene as active via script. This will allow switching of light settings per scene although there do seem to be some inconsistencies with the way lighting works on android
     
    NameOfTheName and Harinezumi like this.
  7. mm1982

    mm1982

    Joined:
    Apr 28, 2015
    Posts:
    35
    Thanks for the info. So basically just setting the currently visible scene as active will make that scene's light maps/settings applied? This works for many loads/unloads of additive scenes?

    I was reading in this thread that you also will have to manage the unloading of lightmaps and the re-indexing of maps as you load/unload scenes? Is that still required? Do you do that in your game?

    I haven't done a larger test myself yet. I'm actually considering not baking at all anymore. My game is going to be an indoor, 2.5D side scroller. I'm hoping I can get away with deferred lighting and all realtime lights. Baking was too problematic due to long bake times and slow iterations to get a look I like, and I'm no designer anyways, so no baking is what I'm currently experimenting with now.
     
  8. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    This is actually a pretty bad oversight on part of the Lightmapping guys. We break our world maps into many scenes, with a master XX_Lighting scene too - but this is only good for Runtime, where the Active Scene distinction is easier to work with.

    In the Editor, while actually making your game, you have the problem that you have to set the Lighting scene as Active, otherwise you get what your images show. This is bad because if you're editing gameplay stuff in the primary (no lighting data) scene, then every Create action you perform is sending objects to the Lighting scene - and so on with other related Active-scene ops.

    Pre-Enlighten (Beast), it was possible to _disable_ lightmapping. I have no idea why they removed that option but it should either be brought back, or Unity should provide two "Active" modes: Editing Active and Lighting Active.

    It also does that annoying `The loaded level has a different lightmaps mode than the current one. Current: Directional. Loaded: Non-Directional. Will use: Directional.` thing too when loading scenes additively from a scene with no LightingData (we're only using Directional in this case).
     
    Last edited: Jul 31, 2017
  9. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Was this ever fixed?
     
  10. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    Considering im trying to find a fix for it on my 2019.4 LTS version of the game, I would say no.
     
    ROBYER1 likes this.
  11. TonyVT

    TonyVT

    Joined:
    Sep 11, 2014
    Posts:
    13
    I'm having the same problem, and I confirm that not, it has not been fixed.
     
  12. TonyVT

    TonyVT

    Joined:
    Sep 11, 2014
    Posts:
    13
    If this can be useful to everyone (@sniffle63), I solved it in my particular case: there was a complaint by Unity about the two scenes having different lightmap settings. Once I put the directional mode to non-directional to both, everything worked!

    I mean, in this part of the Lighting settings, the 4th from the bottom should be coherent between the various scenes

    upload_2020-7-21_13-37-34.png
     
    fuzzy3d, apostelzhuk and ROBYER1 like this.
  13. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365

    This also fixes it for us, but the game I'm working on is a large game with lots of employees and maps, so it's literally not possible for this approach to be used when talking about more than 2 levels where each of those levels has different lightmap settings.

    We have a main scene with the camera in it, then we swap out our secondary scene for whatever level we want to currently be playing, and each of those levels has different lightmap settings, and from what I can tell there is no way to access the lightmap settings so I can duplicate the values over from the newly loaded scene to our persistent scene.

    One of my team members wants to just get rid of additive scene loading and load everything with a single scene, but making the rest of the project hard to work with to fix this problem seems horrible.


    And that's ignoring things like Ui scenes and various other things we are using scenes for.....

    Seems like the guys at firewatch had to use a custom scene management pipeline to achieve this.....
     
  14. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    531
    In Unity 2020 there is the lighting settings asset now which makes it very easy to have the same settings applied to multiple scenes. I think this might help with this issue a bit. It does at least for me. The tip above that in order to show the correct lighting the scene has to be ACTIVE was the crucial one for me. It still puzzles me how that is supposed to work if I have multiple additional scenes with baked light...
     
    ultraon83 likes this.
  15. GameFDev

    GameFDev

    Joined:
    Jul 13, 2020
    Posts:
    10
    Is this fixed in the latest 2020 version? Do I have to set two scenes that I additively load as active? Can two scenes be active at once? I'm thinking of doing additive loading but this is. a major deal breaker.
     
  16. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    Update from 2021.2 beta 14 to 2021.2.0f1 causes lightmap problem with additive scene loading. It wasn't a problem before. So far nothing helps...´

    EDIT: Removing all lighting data from "main", empty (camera only) scene solved the problem.

    EDIT: No, :)
    upload_2021-11-5_10-43-40.png
     
    Last edited: Nov 5, 2021