Directional light visible in a tunnel

Hello,

I am experiencing a lighting issue in Unreal Engine 5.8. The Sky Light works correctly: the exterior is illuminated and the inside of the tunnel remains dark. However, as soon as I enable the Directional Light used as the sun, the light appears to pass through the tunnel ceiling and walls. The interior becomes far too bright, as if the direct sunlight rays were going through the geometry.

The issue does not seem to be limited to the generated tunnel. I placed an opaque cube in the scene with Cast Shadows and Cast Dynamic Shadow enabled. The cube receives light from the Directional Light, but it does not produce a visible shadow. This makes it look as though the Directional Light’s shadowing is not being calculated correctly, even on very simple geometry.

I have tried several settings. The project initially used Virtual Shadow Maps with r.Shadow.Virtual.Enable=1, and I also tested disabling them with r.Shadow.Virtual.Enable=0. I disabled Ray Traced Shadows both in the project settings and on the Directional Light. Cast Shadows and Cast Dynamic Shadow are enabled. I tested double-sided tunnel materials and enabled Cast Shadow as Two Sided. I also tried Volumetric Translucent Shadow on the tunnel walls, without any improvement.

I removed the fixed exposure used for diagnostics and changed the indirect lighting settings, but this did not affect the issue. The problem clearly comes from the direct rays of the Directional Light. When I remove the Directional Light completely, the tunnel becomes properly dark and the light leaks disappear, but the exterior becomes very flat and the overall scene looks much worse. Using only the Sky Light is therefore not a suitable final solution.

The project uses Lumen. Virtual Shadow Maps have been tested and disabled, Mesh Distance Fields are enabled, and hardware ray tracing is available. The tunnel consists of walls, a ceiling, a floor and portals generated as Static Mesh Components. Even the test cube fails to cast a shadow from the Directional Light, although it is visibly illuminated by it.

What setting could prevent the Directional Light from generating shadows correctly? Is there a specific configuration involving the Directional Light, Lumen, Virtual Shadow Maps or the shadow mapping method that could cause objects to receive direct light without blocking the sun’s rays?

Hello there @Misteur!

The fact that your test cube doesn’t produce shadows rules out most of the usual suspects for an issue like this (the tunnel’s geo, thickness of the walls, two-sided settings, translucency, etc).

First thing that occurs to me, the directional light that’s used like the sun, is it set to Movable or Static? Considering that you are working with Lumen, it should be Movable, otherwise it won’t produce dynamic shadows.

If that’s the case, the next element to check would be shadow scalability, and ensure your scene is not set to any Low values:

If all shadows values are in High or above, then I would go back to the Directional Light, and check it’s parameters tied to CSM and DFS:

If all else fails, I would test a simple version of your setup in a clean, test project, to rule out particular settings to your project, or even an issue affecting your entire engine install.

Hi @brs-sebascova ! Thanks for your reply, I’ve checked the light, it is movable my scalability groups are epic, I’ve checked the Directional light with the CSM and DFS, and nothing worked, I can give you if you would a light copy of the section I’m using to help you figure out what’s happening, I’ve been on this problem since yesterday without finding a solution atm…

Here’s the link of my light project, don’t worry about some things being broken it’s beacause I’ve deleted my plugin : SwissTransfer - Send large files securely and free of charge

Hello again!

Thanks for the sample project, I opened it on my end, and it looked exactly as yours. I tinkered around with the lighting setup, and the generated meshes for the tunnel, to no avail. At face value, this should be working.

What did work, was taking the contents of your scene, and migrating them to a different, clean project. Once loaded there, I opened your test map, and lights/shadows started behaving exactly as intended.



Meaning, something particular in your project is causing this issue. Since I migrated your content only, it means that anything in your cache, under folders Config/ and Saved/, is not being used. So, I would suggest clearing up your project’s cache.

The next thing to review was differences between engine files. I used Notepad to open your sample’s DefaultEngine.ini file, and compared it to mine, a clean project. Your file has six extra lines:

r.Nanite.ProjectEnabled=False
r.RayTracing.Shadows=False
r.HeterogeneousVolumes.Shadows=False
r.Mobile.AntiAliasing=2
r.Mobile.ShadingPath=1
r.MobileHDR=True

The main takeaway, is that your project has Nanite disabled. Checking further on your file, you also have r.Shadow.Virtual.Enable=1, and this the cause of the whole problem. VSM is designed to work along Nanite, it won’t give good results without it.

So, I went ahead and disabled VSM by setting it to 0, which solved the problem. The opposite is also possible, I enabled back VSM, then changed Nanite to True, and the issue remained fixed. It’s up to you, and the needs of your project, to pick what combination is better.

I’ve tried to change the with the nanites in the settings, nothing happened, I’ve tried to delete the cache, nothing happened, I’ve made another project from scratch, retrying it, still didn’t worked. Still searching…

I’ve found it, just disabled dynamic shadows cause of the shadows it gave me at certain times, it was this that caused the problem…