Download

Occlusion doesn't appear to be working correctly? Dynamic lights behind a wall eating performance.

So I’ve run into a scenario that I’m a bit confused by. I was noticing some strange rendering costs in my scenes so I setup this test level to debug what was happening. It appears that UE4 is still rendering my dynamic lights even when they are out of view (behind the camera or behind a wall), so when my camera points in a direction that may have a number of lights in that direction I get massive performance loss. Even though I can only see 1 light in view, its actually hitting me with the costs of all the other lights that are hidden in that view.

I’ve attached screen shots to show how things are setup to test this. I setup a scenario that has lights behind a wall and a scenario where there are no lights behind the wall. When looking at the direction that has lights that should be occluded, you can see the FPS drops to 60. When looking in the direction that has no lights behind the wall, fps remains high at over 100. I also did a freezerender of each scenario to show what is happening. You can see the light positions thanks to the fog. (I tested deleting the fog from the scene to see if this was the issue but it still occured without the fog)

Does anyone have an idea why this occurs?

Not a very good way to test.
if you want to know if something is rendering or not you should freeze rendering, eject from pawn, and pan around the scene to verify.

As far as the occlusion not working, I do not believe lights ever had this. Mostly because they work differently and are required in most cases to choose what needs to be rendered and how.

However point lights at least have a max draw distance which is set to 0 by default, so they always render.
they also have a fade range. You can try to play with those values.

Otherwise you just script them on/off at the level base with a simple trigger area that enables disables them as you walk through the level.

There are tons of ways to handle this.
making every light a blueprint so you can instantiate and manage the On/off individually is a decent idea.
Probably the best since you are better off adding a sphere collision to run detections off of then you are constantly querying every light in the scene.

Its not the easiest thing to setup. I would suggest having a look at the content example stuff.

If you havent already I would suggest having a look at the academy.
There is a course called “an in-depth look at Real-Time rendering” that explains a bunch about pretty much anything that lights can do. Maybe they even cover the distance settings…

[USER=“3140864”]MostHost LA[/USER] The second shot from each view is with Freeze Rendering from my active player view. Might be hard to tell from how dark the scene is.

I was hoping that if the light itself and any active geometry it was affecting were being occluded, then the light itself would deactivate but it sounds like that isn’t the case. I did look into distance fading already but that won’t work as a solution since there will be cases of a longer ‘hallway’ areas where the light needs to be seen long distance, but there might be a hallway right next door so having a long fade distance will still have a bunch of active lights that aren’t in view taking up resources.

I was hoping to find a solution that wouldn’t require manually setting triggers to turn certain lights on/off but that may need to be the case. I was also looking at level streaming and that also may be another way of solving for this. I guess I was really hoping there was some hidden feature already built in to handle dynamic light occlusion better :frowning:

And yeah, I’ve watched the real time rendering academy videos, a lot of great information from them!

Thanks for the information and for taking the time to reply, I really appreciate it.