Dynamic Lighting Shadow Bias problems

My apologies for the vague topic name, but basically I am creating a level of a house, with white plaster walls (the standard), the player character is small (like a cat), and can run around in this level.
I wish the player to be able to interact with lights in the environment, to be able to turn room lights on and off, in fact, light will play a major part of the gameplay. There will not be any day/night cycle affecting the rooms however.
So as far as I understand, I will need to use dynamic lights for every room, switches to interact with those lights to turn them on/off or dim them.

The problem, that I have, which is the same problem I had in CryEngine, is that with dynamic lighting, the issue of shadow biasing arises, where great big dark shadowy lines appear.
This can be remove by upping the shadow bias amount to something like 0.8 from 0.5, but presents a new issue, shadows then become noticeably offset.

I am by no means an expert at lighting, and wish to ask if there is some tried and true method that people use for their scenes and games?

I feel that it’s more likely just a lack of my knowledge, but I have spent days trying to find a solution, only to find that the lump on my head is growing larger as I continue to bash my head against a brick wall.

Thanks in advance, any help would be…uh…unreal tsk tsk :stuck_out_tongue:
(is there a vBulletin feature to create a spoiler tag so the images can be hidden and opened as needed by viewers?)

Pay attention to the book case lighting

Dreaded dark shadowing lines o’ sceney death.

Offset shadows

Lighting seems to go through the object as if it were semi-transparent. Low shadow bias eliminates this effect. Also, 2 sided lighting is on all of the objects.

Hey Otreum,

While adjusting the Shadow Bias will help curb this with brute force, but if you adjust some of the sliders in the Cascaded Shadows tab under your light component this will help more than just using shadow bias. I’ve put a link at the bottom to help explain these settings and to demonstrate better results. This will be up on the Wiki for lighting troubleshooting and tips later this upcoming week. There is some information up there currently about this, but only going over Shadow Bias and Shadow Filter Sharpen. I’ve added more information going over the Cascaded Shadows tab with explanations and image demonstrations. The link below will give you a PDF version of what will be up later this upcoming week when we get time to put it up.

Before making any adjustments to Shadow Bias directly I would use some of the options in Cascaded Shadows tab. Specifically the distance and the distribution settings. The distance, by default is set to 20,000 units. If you’re indoor environment will never use shadows at that kind of distance you can reduce the distance significantly so that the default setting of 3 cascades aren’t having to be distributed over that far of a distance, this will help in some respect as well.

Dynamic Shadows Wiki Guide: Dropbox - Error

Have a look at the doc and if you have any questions feel free to let me know.

While that is super helpful for directional lighting, especially when I do outdoor scenes. I am just using Point lights for internal light globes that can be switched on and off, which do not appear to have the cascading settings (I am currently using build 4.6.1…now downloading 4.7.0 preview).

Unfortunately, that leaves me back at square one again since point lights do not have any settings for Cascaded shadow maps, at least not on 4.6.1.
The only light that allows me to change those settings seems to be a directional light, but that type of light source has no place in my levels except for lighting coming from outside of the house.


I did a bit more toying around today, earlier on, I remembered about the purpose of stationary lights, so opted to make my lights all stationary. I then turned off indirect lighting intensity, and baked my lights.
All I had to do then was go through my modular meshes and make sure they had a lightmap UV that was appropriately layed out.
As seen in the screenshot below, I have achieved the desired lighting…or at least the first pass (need to try and work out how to have light bounce around a room from the stationary lights without them baking…i’ll probably have to manually add some ambient point lights)
The only artifact that is now present is that the light going through a square doorway has rounded corner shadows, as you can see in the 2nd screenshot.

With most scene I actually recommend baked lighting as you get more from that that than you necessarily would with dynamic lighting. I don’t always recommend it for most who have said they’re using Dynamic lighting because at that point most have made up their mind and don’t want to deal with the creation of lightmaps.

To get more bounce light in your scene you can go into the World Settings > Lightmass > Num of Indirect Lighting Bounces. By default it is set to 3. You can change this value manually by typing in the number you would like.

This is also on our lighting guide: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

Adjusting the Environment Color here as well will determine the color of the shadows that are baked. Using a value lighter than black can get your lighter shadowing as well.

For the square window image issue, what is the lightmap resolution of the wall where the shadow is being cast? You may just need to increase this if it’s too low.

Thankyou good sir, I am open to whatever the best or most successful solution in my case, which seems to be what I have found now :slight_smile:

As far as the lightmap resolution, oddly, I have tried 128, but also tried 2048…there is actually no difference between the two, as strange as that may be :\
Also, the UV’s are perfectly lined up to the grid and appropriately space between the wall, the floor trim and the ceiling architrave.

Also, as for light bouncing, I would love to utilize it, but unfortunately leaving it on presents some major issues. Mainly that all of the walls remain well lit, even when lights are turned off.
Not only that, but since everything is modular, there are noticeable difference in lighting on each modular wall piece with indirect lighting on.
It would be awesome to turn a light on in a room, and have it bounce light into the corridoor outside, thus lighting it up, but unfortunately it just doesn’t seem to be working for me no matter what I try.
I feel as though i’m missing something, but at the same time, I have no idea what…it’s hurting my brain now :stuck_out_tongue:

I also have the issue of overlapping stationary lights. The engine doesn’t allow more than 4 to overlap at a time, which presents a problem when houses have so many lights inside of them, all within close proximity, all lighting up large areas.

hmm…if the light is set to dynamic does it appear correctly? If so, then I would be looking at issues with the lightmap resolution and UV layout. Even though you said you tried 2048, I’d be curious to see the layout if there is a difference between the dynamic and baked version. If not a difference I would be looking at the mesh position and moving the light troubleshooting where the error may be occurring.

This thread should help a lot with explaining the modular seams that you’re seeing. A lot of this information will be more formalized soon on our Lighting Guide for the Wiki. It’s a big topic and needs to be explained well.

While that thread goes into everything behind it, if you understand lightmaps and using the grid for your lightmap resolution then all you should need to do is adjust the World Setting > Lightmass > Lighting Smoothness to ~0.6 and Lighting Quality at 2 or above.

If don’t have a post process in your scene make sure there is one. By default eye adaptation is on and will make it easier to see in darker areas. I always disable this by placing a post process and setting the Auto Exposure Min and Max values to 1 before setting up all my lighting.

After turning auto exposure (eye adaption) off you should be able to see the results of the bounce light much more easily. :slight_smile:

This is correct that you can only have four overlapping. One for each RGBA channel. My question for you specifically now would be is this a game or is this for ArchViz work? If it’s more for arch viz work and you don’t need character shadows then use fully static lighting. With point and spot lights they don’t have dynamic shadows for anything except any movable objects and characters. Everything else gets static lighting. Beyond that using smaller radius for your stationary to have only 4 overlapping at a time would be the best method.

If the light it set to dynamic, the shadow edges of the doorway appear correctly.

That thread helped a great deal :slight_smile:

Just so you have a bit of an idea of what i’m trying to achieve, I’ll give you a bit of an overview:

It is first person (non shooter) game, with full body awareness. (for now, for the sake of testing, I have just used 3rd person template and attached the camera where the characters head is…which I’m not sure is the best solution, but that is something I will research more later for the most viable solution).
The player is small in comparison to the world.
There will be a mixture of static and move-able objects.
There will be a mixture of stationary and move-able lights, however move-able lights are generally only small, not lighting up a large area. Lighting will play a major role in the game-play.
I wish darkness to be pitch black in area’s that there is no outside light coming in. (eg. An ensuite that does not have any windows, and the door to the ensuite is closed)
Move-able objects will be things such as light switches, lamps, boxes, doors, draws, fans, pillows, toys, taps, ropes, cords, hoses, and so on…
There will be a multitude of animated actors, sometimes in large numbers, they will have shadowing and can interact with the player and interactive objects within the game world.

I am modelling everything 1:1 scale in Maya, exporting 1:1 scale, then in UE4, I scale the objects up to 7 times their size, except for the player. (I’m only doing this for the sake of prototyping. I do not believe this is the best solution).
I am open to suggestions for how I should scale things, as I have only done this just to rough up a proof-of-concept or prototype.

I believe (uneducated guess) that with the current scaling, if I set my indirect lighting scale to 1, it will be mismatched with my lightmap resolution of my objects since they are all scaled up by 7 times. And I believe that this is causing an issue with my lightmap scale, unless I change my lightmap scale to 7.
As a result of everything being so large, my lights need a larger attenuation radius and higher brightness levels to effectively do anything…for example, brightness is now set to 50,000. They were roughly 1500 before, and since then I have tried various other values with no success.

At the moment, while I have 15 light bounces, the light just doesn’t reach the floor of my rooms as you can see, I assume this is because the light only bounces within the attenuation radius? The corners are all dark, rather than being lit up, and if I make the light even slightly bigger to envelope the entire room, it will turn into a dynamic light. The only solution is to move it down to the middle of the room, but it looks odd then.

The next problem I have is that the move-able objects for some reason are illuminated in complete darkness. I made them move-able just as examples.

Hi, did you find a fix for the movable mesh being wrongly lit?

Hi Thomas,

I unfortunately did not fix it :frowning:
I gave up after about a week of trying several different things, and decided it would be more efficient if I moved onto other things for the time being.