How to optimize lighting?

Hey there,

So I have a little game that I’m working and in our first main interior map, a lot of the errors after the build where coming up such as:

“Error PointLight_15 Severe performance loss: Failed to allocate shadowmap channel for stationary light due to overlap - light will fall back to dynamic shadows!”

So I changed the lights to movable, which I realize doesn’t bake them into the map, and got a much much nicer result with no errors.

However I was worried it would hurt performance too much so changed them to static and now it looks like this:

Obviously I don’t know a lot about lighting here.

Is there something I can do to optimize the performance of the game while still getting it to look like the top picture?

Thanks!

Check the attenuation values of all your shadow casting lights; I believe that if you have more than 4 lights casting shadows all intersecting each other, it will cause that error message. There might be a light overlap debug mode you can use to debug this properly.

As a rule of thumb, dont turn every light into a shadow casting light; only use them where your shadows will be most obvious :slight_smile:

1 Like

As far as lighting goes, dynamic lights cost a lot in performance, and they don’t get things like GI.
So for any situation where the lights don’t need to change in any way it’s best to use static lights.
But you need to have your lightmaps setup correctly, each mesh needs a second UV channel that you would set to be used for lightmaps, and then you need to adjust your lightmap resolution (default is 32x32) to give you enough quality for each object.
Here’s a guide on creating lightmaps: Unwrapping UVs for Lightmaps | Unreal Engine Documentation

To get the best quality, you would want to create the lightmap UV’s by hand, but your current UV’s might already work well for lightmapping as long as they don’t overlap and fit within the 1x1 UV space.

If you’re not getting any error messages about lightmap UV’s after building lighting then my guess is that your lightmap resolution is too low, to get sharper shadows you’d have to increase the resolution. If you haven’t built your lighting yet, then try it at draft settings first, if things aren’t setup for lightmaps then it’s going to have lots of errors.

By the way, your scene looks really fantastic, even with the dynamic lighting that doesn’t have GI it looks pretty good. If you can get your static lighting baked then it will look even better since you’ll have things like bounce lighting.

Thanks for the reply guys! Everything is setup for light maps as far as I know. Are static lights supposed to look like how they look in the bottom picture?

From what I understand there is no settings I can change in the engine to get it to look like the top picture without making the lights movable?

You should be able to get similar results to the top image with lightmaps, to me it looks like the lightmap resolution is too low, since I don’t see any visible shadows anywhere, just general shading. In that type of scene where it’s mostly dark then I would expect to see a bunch of lighting errors if the lightmaps were too low, so that makes me wonder if there’s something else going on.
You might try turning off all the lights except for like one, maybe that spotlight on the left and then do a test build of the lighting and see what happens.

As far as settings to mess with, each light has settings, and then each mesh has a setting for lightmap resolution which can be set in the content browser or you can select the object in the map and change it for that specific item. Besides that, there’s the lightmass settings in the world settings, and then the lighting build quality when you build your lighting.

From what it looks like it almost looks like there’s a skylight or something like that that’s creating a general ambient lighting.

Ok thanks I’ll try to dive a little deeper and look into those things.