Streaming Levels and Different Directional Lights

Hi all,

Sorry for the wordy post :slight_smile:

I am working on a single player project, which currently has 15 maps. The setup looks like:

  • one persistent level which has world composition enabled
  • each map is streamed in/out as the player gets near/far away from it (some maps are “sound only” levels and overlap)
  • an “Atmosphere” level, which is currently always loaded in the persistent level. It contains the directional light, fog and sky.

I am at the point in the project now where I’d like to show a progression in time, so switch from early morning to afternoon, and in the future to evening and night.

I thought I would be able to do this by streaming in and out the first Atmosphere level and adding another with the light settings I’d like to transition to. I did some testing and that doesn’t seem to play nicely with CSM (even when the first directional light is fully unloaded), and lightmass only uses your first directional light, so I’d have to have two composite levels for lightmass: each with one atmosphere level and the maps that use that atmosphere, and bake separately.

What I need really is a directional light which has a bounding box, so that lightmass will know which light to use when baking and where, and the game will be able to switch lights at a certain point (masked by a building, underground cave, etc).

I’ve also considered using just spot lights to simulate the sun in those maps (which would solve the bounds problem), but that means I can’t use CSM, and it also means that the shadows will not be parallel, as they are with a directional light.

–

Has anyone else had this problem, and found a way to get around it? I’m trying to make it so all levels stream, I would like to stick with the one persistent level if possible.

Cheers,

Alan

2 Likes

We are doing an open-world game and have also considered day-night cycle and all that. From what we’ve gathered, there’s no feasible way to do that in UE4 using baked lighting, since first, you would have to copy your levels as many times as you want to have lighting states (because you can’t really bake more that one lightmap on a mesh). So we could have morning, day, evening and night lighting, and copy our content 4 times. Not good.

We also can’t build lighting 4 times on the same levels, since each object can only have one lightmap. And even if we could, how would we switch between those? No option to do that as well.

Other option is to go fully dynamic. As far as i’m aware (and i hope someone corrects me) it will be painfully slow.

So if you are not willing to copy your content, i guess there’s no valuable option of doing that. Maybe (and i hope) i can be proven wrong?

Hi ,

It’s a slightly different problem - it sounds like you’re describing a day/night cycle, where any map could have any time of day attached to it.

I’m describing something a little more linear:

A Persistent level with N streaming levels below it:-

  • Streaming level 1 with “morning” directional light
  • Streaming level 2 with “morning” directional light
  • Streaming level 3 with “afternoon” directional light
  • Streaming level 4 with “afternoon” directional light
  • Streaming level 5 with “evening” directional light
  • …

In this case, one streaming level would only have one type of directional light applied - level 1 and level 2 are always morning, level 3 and level 4 are always afternoon, exactly as you would if using different persistent levels. However I would like to make it work with level streaming, and figure out how to bake it with lightmass :slight_smile:

Alan

Oh, i get it now. That’s indeed different. What i would do then is to build lighting on every level separately, like you mention in your first post. And get rid of CSM, if that’s the only issue with streaming lighting levels in and out.

Hi,

I can’t build lighting on each level separately, as the lighting would end up uneven at the places which the levels switch - so where level 1 transitions to level 2 there would be a harsh transition where the two different level bakes meet, and between level 2 and level 3 (which would have different directional light settings) there would be an even harsher transition as the directional lights change (morning to afternoon).

I need to bake the levels together so the transitions are smooth - however, even if we ignore CSM, I can’t have more than one directional light.

I think there’s two options:

  • Keep streaming everything, but bake with per-level spotlights to simulate the sun, no directional lights (no CSM)
  • Separate persistent levels at the different times of day, one directional light per persistent level (can use CSM). Some single player UE3 powered games I’ve played used that technique - I think Bulletstorm was one of them.

I don’t like the idea of yanking the player out for a loading screen, but it looks like I can’t use different times of day if not. Will have to have a play around, see what feels right.

Cheers for the help,
Alan