Lightmapping a lung tunnel (lightmap duplication)

I am trying to lightmap a long tunnel with repeating segments.
Baking the complete tunnel would result lightmaps being duplicated a lot.

Is there any good way to make each segment use the same lightmap?

My current workflow is to use GitHub - Ayfel/PrefabLightmapping: Script for saving lightmapping data to prefabs. Used through the Assets tab in Unity. Place your prefbas in the scene with this script at the root. Set up your lighting and in the editor go to Assets->Bake Prefab Lightmaps. After is processed you can now spawn your prefabs in different scenes and they will use the lightmapping from the original scene. to bake the segment prefab in a separate scene.
This works for the lightmaps.
I can even bake additional objects in the scene by setting the LightmapScale of the prefab to 0 after baking it to prevent it from being baked again.

I do not have a solution for lightprobes however.
They cannot be baked with the prefab as they wont be loaded with the prefab nor can they be baked in the final scene as they dont use the correct light bounces from tunnel segments when set to LightmapScale 0.

It seems like Elder Scroll Blades uses a custom LightProbe provider (Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite 2019 | PPT)
but I would like to avoid this workaround if possible as its quite elaborate.

Would be greatfull for any simpler solutions or hints.

Thanks,
Pascal

Hey Pascal!

Have you tried using multiple scenes, one for each segment? You can add LightProbes to each scene and use LightProbes.Tetrahedralize() to regenerate the tetrahedralization that is used for the probe lookup.

Cheers

Hi,

I have not tried that yet as I thought it was impossible to move lightprobes after baking.
Does LightProbes.Tetrahedralize() take the lightprobe position into account when moved during runtime?
As I am trying to use the same segment (scene) multiple times I would have to offset the loaded scene.
Also this would break the edit time preview as I cannot load and offset the same scene multiple times during edit time.

Or did you mean using a seperate scene for each segment?
This would produce a lot of overhead as I would need to create and bake a seperate scene for each segment even though they are exactly the same (with an offset)

Thanks