Procedurally generated maps with pre-baked lighting: is there a way?

Hi guys! I’m currently involved in a project where one of our goals is to stitch together levels at run time from pre-generated rooms. Our hope was to bake out the lighting information in each room using lightmass and then spawn the levels in position using level streaming. However, this thread (Streaming levels with an offset. - Feedback & Requests - Epic Developer Community Forums) appears to indicate this was not possible as of the middle of last year.

Does anybody have any good suggestions for how to best implement this? The dynamic lighting in-engine is not really adequate for the type of lighting and shadowing we were hoping for, and we are relatively OK with the idea that each chunk will have mostly separate lighting conditions from each other chunk.

One suggestion an artist made was for us to bake lighting in an outside 3d application then import it as a pre-baked lightmap and skip lightmass entirely. This seems roundabout and a huge shame given that lightmass seems to be pretty solid in many other ways.

Are you randomly connecting fixed rooms or do you also generate the contents inside of the rooms? In the first case using level streaming may help, where each level has baked lighting. If thats not the case, well you have a very interesting challenge. :smiley: Would love to know more about whether this is possible as well.

With a fair amount of engine modification and design constraints, it’s doable, but not for the faint of heart. The jist of it is, if you only apply translations to your levels, your light maps are still valid. Lightmaps are baked at a fixed orientation so translating them remains possible… As long as you don’t bake in something like a very large point light overlapping the level. Directional lights are okay, since they aren’t affected by translation. We’ve also modified the renderer to accept a single Z axis rotation, which transforms the coordinates at which light maps are sampled.

Unfortunately, and this is where my knowledge gets hazy, the streaming level system doesn’t really support this. Our other engine/rendering programmer ended up creating a separate system that preprocesses and serializes sublevels into a special format which is then used at runtime in a custom made spawner. I’m not entirely sure what limitation forced him to go about it this way. From the top of my head, the issue was either light maps in streaming levels or repeating the same streaming level more than once. If it’s the latter, then the good news is that might not be necessary – I sent him this forums thread where Epic dev Marc Audy shows it’s apparently possible to spawn multiple copies of the same level, and we might investigate after GDC/PAX/total chaos. If it’s the light maps, then good luck.

I’m really not familiar enough with the system (procedural generation is just about the only thing I haven’t touched in our game) to advise any further, only to know that it’s possible to an extent.

Awesome, thanks for the link . I shall investigate!