Dynamic shadows artifacts

Theorically yes. It will remove slope shadow acne on any object, including landscape.

Thanks for taking the time to reply and great job on the improvements.

I think this is the commit:

https://github.com/EpicGames/UnrealEngine/commit/4b37196980704836fc46333053d6b0f156cf4df2

I am sorry if I misunderstand something, but is this fix going to help with completely dynamic lighting or is it only viable for lightmaps? The explanation of ShadowMaps in the Wiki isn’t very clear on this.

This is unrelated to lightmaps - dynamic lighting only.

seriously thanks for finally looking into this.
it’s been long due but it’s highly appreciated that you don’t totally forget about standard techniques in favor of the not-yet-standard future ones (raytracing)

Well, good to see it being addressed. While the changes are not finalized, I’ll leave a bit of a feedback.

The biasing is flawless now, but another related issue, discussed in the very same thread is still here, which is inability to adjust biasing for each cascade in directional light CSMs individually.

Without it, there is still a problem, where one cascade is underbiasing while the next one overbiases, resulting in noticeable transition between cascades, which is greatly exaggerated by receiver bias.

Finding sweet spot, where transitions are less noticeable, while also getting rid of most acne is still hard to impossible.

I think considering letting user set up biases per split would be an overall good move. @Charles.D2
Adding to that, It would be interesting to know just for the sake of satisfying curiosity, why light dot vertex normal is used for slope, instead of SlopeScaledDepthBias. I mean technically, it would break biasing to some degree on anything with edited normals (eg. quite often, foliage).

UE4 adjusts depth bias automatically per cascade, based on texel ratio between cascades. Setting manually bias per cascade may be a bit too complex, maybe something like cascade bias “bias” would be easier to set. Anyway, can you point as to problematic cases in this thread?

Yes, but depth bias render state is a bit problematic, as it’s included inside a PSO and would multiply number of existing PSOs by number of different bias settings. It’s a good choice for a single game engine where one can hardcode biases, but in case of UE4 with its flexibility - bias per light, multiple shadow shaders, material graph etc. this can lead to issues with too many PSOs.

Could that be fixed by calculating geometric normal using DDX/DDY and only use vertex normal when that fails.

Cheers for clarifying the reasoning.

One
Two
Three

Closest cascade is underbiasing, while furthest is overbiasing. Applying enough bias to get rid of acne in closest cascade overbiases furthest cascade.

There is also a scene and setup dependent factor in it, since when kernel becomes larger than most geometrical details, you can naturally get off with less bias.

Maybe exposing scaling factor instead of fully independent per cascade bias would be better ?

I don’t think this is viable for depth rendering at all.
Biasing errors on geometry discontinuities, worse overall slope representation and a strain on pixel shader, that should not be there for depth rendering.

DDX/DDY is another alternative. This one would require a beefy fullscreen pass in order to gather at least 5 nearby pixels for normal reconstruction, and still would fail from time to time on some very thin / small geometry / alpha masked fences etc. Also performance overhead would be problematic for certain use cases like VR or mobile and force users to re-tweak bias parameters for those.

Thanks, looks like something worth looking into.

1 Like

Testing the slope solution in the 23 preview, and the results are very inconsistent. The slope bias helps a little, but it needs a huge value for close up distances, and this makes it broken in the distance. Looks like the bias is waay strong in distant cascades.

Overall doesnt do much to me, when I solve the acne issue in close ups it broke in the distance and viceversa. Anyone has tested it? What are the better values?

Ah ■■■■, I was already expecting this. I am waiting for the full 2.23 release to see if the dynamic shadow issues have at least partially been fixed, but it seems it won’t…

Any news on fixing the current implementation of the shadow slope bias?

Not yet, I am waiting for the full 4.23 release to see if anything new has been done to solve this problem. Fingers crossed lol

So now that I tested 4.23, I can safely say that the “fix” by Epic didn’t really help. While it removes some of the shadow artifacts, it adds some on other parts of the terrain / mesh. Like II_ADN_II said, the results are very inconsistent.

What’s worse is that dynamic shadows now seem to be completely broken on landscape terrain in 4.23, I made a topic about that: https://forums.unrealengine.com/unre…n-on-landscape

Also if I use Shadow Slope Bias, it makes static mesh shadows very unrealistic as can be seen in this picture:


The only way to fix this is to set “Nu(mber) Dynamic Shadow Cascades” to a maximum, but that “adds significant render cost”.

Bump. Its a shame that this still an issue, right now it only needs to be consistent within all cascades.

And I actually wondered why our preview spheres inside the Material Editor and also Landscapes getting this odd effect. Yes, it would be nice if this gets a very high priority very soon!

In case anyone missed it, 4.24 added new setting for directional lights, that being:

You can use it to adjust amount of biasing each directional shadow cascade has relative to the others.

As of 4.24, as I see it, issues, discussed in this thread, are safe to consider resolved.

1 Like

So I just tested version 4.24 and the problem is still there. Furthermore, none of the introduced changes really fix the problems, as can be seen in the pictures. First is a dynamic light with standart settings, second is “shadow bias” and “slope bias” raised to the maximum, which has a little effect but it’s still a huge problem and very noticable.



Sadly it still makes the landscape or open world terrains unusable, as it’s just really noticable and breaks the immersion. And the problem is that especially for procedurally generated terrains, you cannot place meshes on top of the shadows.

Epic, can you please get back to this problem and create a fix ASAP ??