Lighting artifacts on large terrain

Take a look at these screen shots:
Lit:


Normals:

Mesh:

Normals seems good. Triangle is quite big. Scene is lit by directional light. I enabled large worlds in World Settings. The terrain is planet with radius 80 km. How to get rit of these artifacts?
EDIT: Artifacts are related to shadow casting.

1 Like

Shadow acne, this is an inherent problem with shadow maps. You can mitigate it somewhat by adjusting the shadow bias settings but you’ll never completely get rid of it when the light is hitting the surface at a shallow angle. Your best option is to use more geometry and have more varied terrain so that it is less noticeable.

2 Likes

I had a similar problem, weird shadows on the surface whenever the light was almost parallel to the plane.
And I haven’t found a solution to it yet.


This lighting/shadowing bug is SO ANNOYING.

I’ve spent 20+ hours trying to diagnose it, and has become a serious roadblock in my progress. I’ve checked light source settings, level lighting settings, project lighting settings, geometry UVs, geometry normals/tangets, etc…

The cause seems to be enabling Dynamic Shadows on the Directional Light, and the problem is most easily seen on landscape or terrain with some slopes on it.

This problem can be reproduced easily in UE5 by creating a new project, adding a bulge to the terrain, then Play and observe how the shading artifacts occur around the bulge. Right out of the box!

I want to say that this problem is “related” to shadow maps, but no amount of fine tuning those fixes it. Not resolution, not bias, not any of the thousand other settings, nothing fixes it.

There is no acceptable fix I have found on Epic forums or Google or Discord servers, other than changing your lighting methods and making compromises. I want to use Dynamic Shadows on the Directional Light. If that’s not production ready then why did they include it?

The only workarounds I’ve found so far are A) turn on Raytracing and the issue goes away (requires high end PC) or B) include a second Directional Light with Dynamic Shadows disabled so as to “wash out” the artifacts of the other light (hacky, reduces quality, twice the performance impact).

How are all the thousands of Unreal developers out there handling this issue? None of them using Directional Light with Dynamic Shadows?

It really takes the wind outta my sails.

Shadow Acne is generally related to the infamous “Shadow Terminator Problem” which I cover in this video. The terminator problem is responsible for the jagged lighting in your terrain @hectavex.
Virtual Shadow Maps do not currently respond to the Cascading Shadow Map bias, (or the bias setting alone may be insufficient in the case of Cascading maps) but I show here in this video that you can manually bias the vertices on the material level to eliminate shadow acne and jagged terminators.
In the case of terrain, you can offset the shadow casting geometry in the shadow pass using WPO in the negative normal direction by a small amount.

This isn’t an Unreal Engine issue, it is a 3D graphics issue. It even happens in offline renderers. It is caused by the fact that shadows are cast by geometry, which is often much lower in detail than the smooth shading which handles the pixel or vertex lighting based on normals.
The only options are to bias, or adjust the mesh so that the normals interpolate less sharply across faces (such as reducing the slope or increasing the poly count).

I appreciate the comment and video…very informative thank you.

But while this looks similar to the problem I’m having, I don’t think it is the same thing.

These shadow artifacts are very noticeable and would be hard to mitigate.

I have to wonder…why would UE provide this broken lighting system right out of the box in a brand new level for all developers to witness? The shading problem is present in the included level, on the included landscape in UE5. Then to hear “this is normal, you must work around it”…something tells me this is not the experience Epic wants developers to have. They wouldn’t force developers to work around something systemically problematic, they would provide a workaround (or fix) for us.

So I will be filing it as a bug, because if it’s NOT a bug, I will need to find a better engine to work with.

My home rolled DX9 engine from 2003 did not have this problem:

Every game released in the last decade has managed to work around it.

Having programmed graphics engines from scratch, I stand by my assumption that this is a bug in Unreal which should be fixed, and while it may be related to shadow acne (related to shadow maps) or manifest in the same ugly way, it’s not the same issue as “shadow acne” IMO.

Here are a few other threads which might be related to this issue and appear to be showing a similar problem:

Your d3d9 engine image doesn’t even have cast shadows much less shadowmaps in it so I mean, I don’t really know what it is you’re trying to prove with this.

By all means, submit a bug report.

The “spiky shadows” link is clearly shadow acne. You’re free to try different engines but if they are doing shadow mapping then they have this problem.

Here’s the problem in Godot: Issue with jagged shadows, not sure if it's a scene issue or model issue - Godot Engine - Q&A
Here it is in Unity: unity - Jagged shadows with default settings - Game Development Stack Exchange

The worst example of shadow acne I have ever seen is in Elden Ring, an actual award winning shipped game

The “unsmoothed” landscape issues are from the terminator problem. The jagged dynamic shadow issue on android… no clue. That seems to be something else. Seems like it’s using nearest neighbor sampling on a very low resolution shadowmap.

I appreciate the reply!

Well, I’m not that interested in coining or mythologizing this problem as the infamous “shadow acne” and settling with it. I believe there can be a solution.

Check out this massive thread on the issue…

490 replies! Several theories about how Epic can solve this problem. Scroll down to the latest replies in 2022 and it’s just people saying “me too”. I would file this as a bug not a feature. Hopefully it’s not a “WontFix”. But if we are to all start agreeing that this is not Epic’s fault or problem because other engines do it to, then we are accepting the fate of the WontFix :smiley: And I do believe this can be fixed in code.

I’ll run through that thread later to see if I can find any acceptable workarounds, but it’s starting to look like Raytracing will be my default now.

“its very long time ago question, but i can’t find the way to solve in 2022. so i leave a answer [Use Raytracing] in my case”

“Did everyone at Epic go on vacation and forget to come back?”

Same problem here:

Same problem here, 2014 no answer:

Same problem here, no fix in 2022:

If you dig far enough you might manage to find a post by me on this exact subject. This is one of the very first problems I posted about and like you I found the unsatisfying conclusion that there is no ideal solution to this.

I admire your optimism but if this is that important to you I wouldn’t bank on a fix coming. As you have discovered yourself, it’s been like this for ages.

Epic did make a few attempts to improve this, one was the introduction of contact shadows which allowed you to crank up the shadow bias and cover over the peter panning with the contact shadows. They also added slope bias at some point. Neither are magic bullets.

You can try offsetting the geometry in the shadow pass as suggested in that thread, but that comes with its own problems. All of the ‘solutions’ are really just trading one issue for another. Biasing the shadow results in peter panning, biasing the normal results in lost volume.

If you can find or invent a reliably fix for this then my advice would be don’t wait on Epic, just implement it yourself.

Yes it would still take time to fix so I’ll use Raytracing for now. Thanks for your help and info.

1 Like

For me increasing polygon count fixed problem.