Volumetric Lightmap Streaming Workaround - Multiple VLM - GPU Lightmass Memory Limit

Guide for: Baking and Switching between multiple Volumetric Lightmaps

Why?

Per Sublevel baking is supported - but when you use volumetric lightmaps you have to bake everything at once - on larger worlds this will increase baking time or hit your memory limit.

How?

Unreal doesn’t support multiple VLMs (Volumetric Lightmaps) instead one global volumetric lightmap texture is set on Level load.
But there are two interesting behaviors:

  1. It will use the VLM from the latest loaded Level when one is available.
  2. When baking: the lightmaps are stored per sub Level. But only one VLM is baked and stored inside the persistent level. The Sublevels will not have any VLM data.

→ We will have empty “Proxy Levels” which only contain the volumetric lightmaps and are loaded on demand.

Result Preview
ShareX_379


Guide

1. Creating the scene

In this example I will use a simple scene with a castle and a forest. And the global lighting on a seperate level so its easier to bake.

Toggling the levels:
ShareX_361

2. Baking

Now for everything I want to bake seperatley I will create an empty Level. They will only store the VLM data.
UnrealEditor_364
Here inside the baking scene for the Forest. I will add the forest Level and the Lighting Level.


Now I will bake the scene.

Same process for the castle.

3. Switching

Now I will add the baking Levels to the Mainlevel. Note: It will only add the Level not its sublevel - which is nice in this case because it will only load the VLM.
ShareX_372

Now I will add some simple logic for loading the different VLMs based on overlap volumes.

UnrealEditor_377

Snipped:

4. Result

When I now move the pawn it will switch between different VLM.
Nice thing is you can have a seperate controll over the level loading.
Result


Notes

Sublevel Offset?

Sublevel offset will not change the location of the VLMs. There is a fix but it seems like it will not work in a packaged project. Sad because it was there since 2017… 6 years ago!

https://github.com/EpicGames/UnrealEngine/pull/3627

GetLevel()->PrecomputedLightVolume->ApplyWorldOffset(GetActorLocation());

Loading Problems

I recommend having one VLM to be always loaded - you can unloaded it after the level is loaded. Sometimes if there is no VLM on level start it won’t register new ones.

Faster Development

You can also use this only for faster development and then in the end bake the final level together - no changes needed. Just pressed bake:

Cleaner Transitions

For a cleaner transition between levels and no light popping and less shadow inconsistencies you could have a shared transition level on the border. This would make the volumetric lightmap extend and align. Then you won’t see when they are switched out.

Load other Levels

Keep in mind that any Level which has VLM will apply it on load. If you want to bake some background assets just bake the Levels as Sublevels inside an empty level. So they won’t generate an VLM.

Disclaimer

This was tested on UE 5.1. Tested on packaged project on Windows. Feel free to share your experiences or problems.

13 Likes

I wonder if you could do time of day with a dozen or so different bakes using this kind of approach. I imagine SSGI would help with transition areas and small details without the full performance costs of lumen.

1 Like

Hey thanks for the suggestion, but sadly this wouldn’t work because it bakes only one lightmap for each level. You can not have multiple. For this I recommend looking into “Lighting Scenarios” but then you need to bake the whole world all at once, for every lighting condition. Also all the bakes are stored not per level but all in the lighting scenario, which might impact load times.
Another approach is to make it like borderlands. Not actually moving the cast shadows but changing the color and mood.

Thank you very much for the great guide. <3