Light bleeding a little through wall and affecting shadow

I wanted to revisit this issue again, and I have some new screenshots:

From far away (This is really bad)

Getting closer

Inside a room

I found the shadow bias parameter on lights but only had no bleeding at 0 bias, which also made things look absolutely terrible.

Here’s a scene.

It’s all dynamic lighting and baking lighting isn’t an option since these levels are randomly generated.

You can see a little bit of the light from the other room bleeding through the walls and brightening the shadowed parts a little on the other side in the corners. Is there something I can tweak to fix that?

The rooms themselves consist of just paper thin 1 sided polygons since it’s all meshes arranged in random arrangments and no BSP geometry.

i’ve got similar errors and i also wish to know a solution to this problem…

7XTnJSR.png

Solution is dont use single sided geometry for walls. You need some thickness in geometry to prevent this kind of problems.

I can try that. I’m not sure why that’s the case though. As far as I know, the shadow mapping should know that part’s in shadow based on the wall on the other side. Technically, the walls themselves aren’t paper thin since the meshes that make up the rooms are apart by about 20 units in that picture.

Try setting “cast shadow as two sided”

Tried both of those things and it too didn’t help, strangely enough.

It might be a light map resolution issue or something. I tried forcing my rooms to be apart by 70 units instead of 20 and the effect was gone. So when walls are too close together the light from the other side bleeds through. I’m looking for some way to force the shadow map quality to be higher on those lights.

Well actually, as the light is farther away it scales down the shadow quality and then I can see a little bit of light bleeding through when walls are far away. When I get closer it looks better.

I’m now considering upping the scale of my world by x4 or so, maybe that’ll hide the shadow mapping artifacts better for thin walls. First, I’m doing a full release package build to see if things look better in release.

Try to give mesh some thickness and in World settings under lightmass change static lighting level scale to 0.75 and indirect lighting smoothness to 2 and Max occlusion distance between 200-260.

I’m not using lightmass though, it’s all dynamic shadow maps. I tried adding thickness to the objects but that didn’t help. The walls are actually already thick since the rooms are offset from each other by a few units.

And here’s another example of what happens at sharp corners:

There have got to be some ways to improve dynamic shadow quality. I still wasn’t able to try doing a release package build since the packaging process crashes for me towards the end: https://answers.unrealengine.com/questions/139375/crash-when-packaging-game.html So I’m not sure yet if this is just a problem with me running the game in a non release mode. I worked with a guy a few years back who was implementing shadow mapping in our engine and he was dealing with weird precision artifacts like this too. I wonder if there’s some kind of depth bias or something that can be tweaked when rendering the shadow maps for the lights.

I tried setting up a scene with just meshes themselves and lights and baked the lighting with your suggested settings. It ended up looking like this at production quality. Doesn’t matter much since my game is all dynamic with randomly generated levels, but I at least wanted to try it out and see what it looked like. Corners still look kindof ugly, but I’d probably put in a lot more time if I needed to to find the right settings to make those shadows look good.

Dynamic shadows are hard to make robust, and even if the algorithm is right, the tuning of parameters is hard, too.
If you’re using cascaded shadow maps, try playing with the cascade settings in various ways.
Also, high resolution maps, well-limited light maximum ranges, and no thin/sharp corners are ways to improve quality.
This is important: avoid sharp corners! If possible, round corners out instead.
Also, various floor trim, edge trim, decoration props, and other such tricks are often used by artists to hide the remaining flaws and make a scene look good.

Yeah, I actually probably won’t have too many sharp corners like that. I’m still hoping to fix the thin wall issue. Hopefully upping the scale in my world does help even though it’s a bit of a hack in a way. 1 unit = 1cm makes so much sense, but oh well.

I wanted to revisit this issue again, and I have some new screenshots:

From far away (This is really bad)

Getting closer

Inside a room

I found the shadow bias parameter on lights but only had no bleeding at 0 bias, which also made things look absolutely terrible.

Hi illYay,

With Dynamic Lighting you can control the accuracy of the shadow with the shadow bias and sharpen filter as you’ve mentioned. However, there are limitations with it with geometry that is not at least 2cm thick and at distances.

Part of this can be overcome by increasing the bounds scale for your mesh (You can find out here) Keep in mine this will NOT make your shadows more accurate, but it will provide more distance that your light can be blocked without the mesh occluding. This will impact performance though.

If you can, it may be better to use a stationary light to bake shadows for your meshes. This will give the most accurate result and no cost for dynamically cast shadows during run time.

Oh thanks. That wiki has a lot of the info I need.

By being 2cm thick, do you mean 2cm thick distance between meshes or the bounds of the object? Right now, I’m just working on ugly gray under detailed mockup versions of my environment so I have a lot of paper thin wall polygons for where doorways end up not being created. Later, those walls will be pretty and detailed and probably not paper thin either.

Also I’m using use complex collision for simple during the mockup phase instead of having proper convex shapes for all the blocking areas. Would using thicker convex bounding boxes help?

2 cm thickness for the walls not the bounds scale.

Using meshes with thickness and dynamic lighting really is the best option. A thicker wall will give better results without having to greatly adjust the shadow bias.

I’d say for testing complex as simple is fine. You would want to optimize later by using blocking volumes or simple shapes for your collision. Just to be clear the convex hulls will not have any effect on your shadows. This is strictly collision for your player and any physics objects in your game.

Are you floating the walls? (ie the floor is a separate component from the walls).

If so the best way I found to avoid leaks , assuming geometry and not brush, is to weld the walls to the floor forcing the lighting to map it as a single object. UE4 is not the only engine that has this problem.

As an off the wall guess though it looks like your trying to force beta your lighting values far beyond their limitations that is causing the lighting solution to bleed. This is caused because the “Use Inverse Squared Falloff” is set to on by default forcing you to have to use way more lights than whats needed or to set it’s value far outs side acceptable values.

I’m assuming this is the case as you have a lot of hot and cold lighting with zero balance between the two (

Yeah, I’m still in early phases of the env design and lighting, so this isn’t really even close to how my lighting will look in the end anyway.

I already started experimenting with having two oppositely facing directional lights for ambient lighting to make areas brighter. Then I’ll have some shadow casting lights coming from lamps only for cool effect. I can’t bake static indirect lighting unfortunately since these are randomly generated levels at run time.

I’ll have to try and see if I can try other lighting besides inverse square falloff.