How do I setup lightmaps for additive scenes that get loaded on top of main (empty) scene?

Can somebody please explain how lightmaps really work?

All tutorials work with a single scene only! Nobody explains how to deal with additive scenes!
I am 1 lonely developer not a team of 50 and cannot go into deep research on that matter!

SO!
This is what I have:

One main scene that contains nothing but a gui panel and all controlling scripts, camera and an ocean system. No static objects!
I use the “azure skycontroller” which controls sun position, color and brightness and fog.
There are no other point- or spot-lights.

With addresables I load one terrain scene “additiv” with buildings and other static stuff on top of the main scene.
The user can choose between 2 versions (30mb and 3mb), where the smaller version is the same terrain with less resolution textures.

On top of that I create a harbour from prefabs with dynamic json data coming from my server.
These are instantiated as static objects like jetties, docks and stuff.

Whats happening:
When I clean all lightmaps in the Light inspector and hit play everything gets dark after being laoded, but not completely dark. Even some of my GUIs are dark.
When I hit bake lightmap everything gets lit correctly, even the additive scenes and the instantiated prefabs.
Perfect!

ISSUE 1:
As of today, for some reason the instantiated prefabs began to flicker after I was reorganizing some of the terrain scene data! Not all of them but some, depending on the camera position.
So I deleted the Library folder and after 1 hour re-import the flickering was gone. And just 30 minutes later it’s flickering again! But only in the editor not in the iOS player.
Why is this happening? (I use: Mac OS Catalina, Universal Render Pipeline, Unity 2019.4)

ISSUE 2:
As described above the lightmap has been created without any terrain data present, so I assume that it is not there, right? But everything is lit correctly, it seems. Maybe it would be looking better with a lightmap? But how about the moving sun, then?
Question:
How would I do it correctly? Do I have to open every terrain scene and bake the light there? But it seems there is only one lightmap being used by the main scene. Will the additive Scenes use there own lightmap?

Can somebody please clarify?

Please have a look here https://assetstore.unity.com/packages/templates/tutorials/additive-loading-lighting-examples-129922

1 Like