Using Lightmaps from Multiple Scenes in One Scene?

Hi all,

I’m currently trying to get myself out of a lightmapping issue. I’ve been working on a Unity arch/viz project for a client for a few months now. Being a novice at lightmappign before starting this project, I’ve been able to teach myself most of what I need to know.

I’m taking 3 sections of a skyscraper that are meant to be turned on/off to show off major sections of the building. The bottom floor is the “Lobby” slice, the middle is the “Office” slice, and the top is the “Roof”. In order to get the baked lighting look I’m looking for, I’ve decided to put each slice into their own individual scenes and bake each slice separately.

I have been able to get my separate bakes, but whenever I try to merge one slice from a separate scene into my current scene (ex: try to take the Office slice from one scene and put it into the Lobby scene), the lightmapping looks all wonky and bad. I assume it has to do with the current scene trying to write it’s current lightmap data onto the merged slice rather than merging the lightmaps from the other scene.

I’ve tried copy/pasting the slice and also making a prefab of the slice, but it still looks wrong. Is there any way around this or is it impossible to use lightmaps from two separate scenes? I apologize if this isn’t a good explanation. :confused:

When Unity lightmaps a scene it uses a separate 2nd UV channel and the appropriate UV layout as specified for each of model files (e.g. ‘apply light-mapping UV’s’ or imported UV mapping) then on a per scene basis it generates lightmaps based on bouncing light (GI) in the scene between the objects in regard of scene lightmapping parameters, e.g. number of maps, resolution etc. as specified in the docs:

http://docs.unity3d.com/Manual/LightmappingInDepth.html

Unity has no concept of merging scenes in regard of lightmapping as lightmapping would need to treat any merged objects from different scenes together as one scene in order to calculate the influence of light between each other. To that end you have a choice to load separate scenes together at run-time or in your game view e.g

Or simply re-lightmap the new merged scene, to the best of my knowlegde.

But, when I load scene, all my lightmaps seems broken. The objects from additively loaded scene lost lightmaps and gone white, and original scene objects has change lightmaps in wrong way.

3 Likes

We have the same requirement and we are having the same problem. Even when we point the renderers from the loaded scene to the correct lightmap index, they load at the wrong scale and position.

Here is my question in the Unity Answers section: How to load enlighten lightmaps correctly at runtime? - Questions & Answers - Unity Discussions

This video is also in the question link, but putting it here again to demonstrate the problem:

It’s not clear if the OP was talking about at run-time, or in the editor. In the editor, I don’t think so. But at run-time I can get baked lightmaps to come in fine, but not real-time. If I try to load real-time GI, only the last loaded scene works, and at that the contrast is off. And loading the baked maps, I do get errors about missing GI files, even tho I dont have real-time GI in the scenes i’m trying to load.

What’s adding to my problems is the whole chasing thing. It’s tough to get clean tests because if you have baked real-time GI into a scene once, it thinks it’s still there. You can clear the cache of the project, but that wipes everything out.

I’ve heard you can get the GI snapshot into a scene by creating an asset bundle of the scene, loading it, then loading that scene. But i’ve not worked through that yet.

I’m not trying to load realtime GI, just baked GI. Not working at all for me.
How did you get it to work?

Are you talking about importing the asset bundle in the editor? That wouldn’t help for additive loading though right?

I’m simply loading the scenes with loadleveladditive. I’m not doing any other coding regarding the index or anything. (see link below)

No, importing the asset bundle at runtime then loading the level as you normally would. Sounds like it just makes the lightmap snapshot available, but like I said, I haven’t tried or worked through it yet.

http://www.topofsteel.com/images/2015-03-12_0842.swf

Thanks for the reply. I created a new project just to test if I was missing something. But nope, it’s still the same. Unless anyone can spot another reason why this might not be working for me?

https://www.youtube.com/watch?v=iZbkv2sokZg

This project is super simple, and my script is just

void Start ()
    {
        Application.LoadLevelAdditive("scene1");
        Application.LoadLevelAdditive("scene2");
    }

But unfortunately no luck. Are we on different versions of Unity here? I’m on 5.0.0f2 Pro.

I’m gonna give it a try on my other PC later today to see if it’s a problem with my install or my system or something…

@jnt What rendering path you using? I just did another test project and It didn’t work, I couldn’t see the lightmaps. I was in was in forward. Switched to deffered and it worked.

I have tried that before, and just tried again in 2 different scenes, but no change, lightmaps sill not loading…

I have the same issue as you, I even think mine is worst.
simple scene with loadLevelAdditive

Baked or realtime?

baked

If you check the settings of your Directional Light from the first scene, is it setup for mixed mode? Because it should be baked.

@topofsteel_1 You have Baked GI lightmaps additive-loading in your scene.

Would you consider uploading a generic scene with it working and we can see if it also works for us?

@jnt @Phantomx

Sure…

https://virtualziggurat.sharefile.com/d/s7505f7631d241729

Released version of Unity is 5.0.0f4, so please verify your use cases against that, especially that there were some fixes to baked lightmaps wrt additive level loading in one of the last release candidates.

Once you confirm that baked lightmaps don’t behave as expected when additively loading levels, please submit a bug report and post the case number here. Thanks a bunch!

Please note that additive loading of light probes is not supported yet, but we want to make that work ASAP. See: Unity 5 Additive Light probes - Unity Engine - Unity Discussions

And yes, we do have one bug report on it and that’s the case that was fixed for RC3: Unity Issue Tracker - Realtime GI is broken if LoadLevelAdditive is used

For some reason it was reactivated, we’ll check that. That said, it still makes sense at least for one of you to provide a repro, so we can double check.

@topofsteel_1 thanks for your scene! It helped me find from where the issue is coming from. So in your project if you bake pre computed Realtime GI in the Hall_Bake scene or Room_Bake you do have the issue even if lights are set to bake only and that was my issue too.

I believe I removed everything from the scene except the mesh. But yes, I had my point lights set to bake only. If it helped you, great!