DFAO artifacts on SpeedTree

I’ve been having trouble getting DFAO to work with tree foliage ever since the feature was first introduced. The default DFAO is much too dark for my purposes, but when I try to lighten it with the Min Occlusion (or Occlusion Exponent) setting, some areas remain dark and flicker strongly (see image below). I initially wrote it off as a bug that will eventually get fixed, but since it’s still an issue even in UE4.20, I imagine there must be a way around it.

I set the Min Occlusion in the screenshots to 1 to better illustrate the problem, but it’s very apparent even with lower values. Most of the DFAO disappears when I increase the Min Occlusion, but some areas remain extremely dark. If I brighten up the DFAO with Occlusion Tint instead, these dark areas don’t show up. However, if I increase both Occlusion Tint AND Min Occlusion, the dark areas reappear (see image below).

I tried adjusting the distance field resolution of the trees, but even setting it to 0 doesn’t completely get rid of the dark areas (see image below). I also tried a bunch of different settings on the sky light, but other than the Occlusion Tint, which causes a bunch of other problems, nothing really worked.

In an actual scene, it looks something like this:

This problem has been haunting me literally for years now, so any help would be greatly appreciated!

1 Like

A good way to alleviate it is to use two-sided distance field generation. It’s an option in the mesh LOD settings if I recall correctly.

Thanks!
I should probably have mentioned that that’s already ticked on all of my tree meshes. The screenshots above were all taken with that setting enabled. It does indeed alleviate the problem a little, but unfortunately not enough to make DFAO usable for me.

Uncheck skylight’s “Lower Hemisphere is black”. That helps a bit. But you can not completely get rid of it because that’s how DFAO is designed to work. In overcast lighting setups this issue is a game breaker.

Thanks for the tip, but disabling the Lower Hemisphere Is Solid Color setting doesn’t appear to have any effect on the black DFAO spots.

I guess my best bet is to keep the Min Occlusion at 0 and only use Occlusion Tint to dynamically adjust the DFAO brightness based on time of day and indoor vs outdoor areas.

How it looks if you don’t use a normal map?

Removing the normal map (or rather, using a vector 0,0,1 as normal map) does indeed lighten up some of the shadows, but the majority of dark spots still remains.

Any chances you can send the scene?

Unfortunately, I don’t think I’m allowed to upload my own SpeedTree assets as project files. However, the trees from Epic’s “Open World Demo Collection” appear to have the same issue. The dark spots are not as extreme as with other trees, probably because they don’t have the same density of leaves, but they’re still easily visible. Since the “Open World Demo Collection” is openly available, I hope that uploading assets from it is permitted:

Sampleproject (33MB)

This seems to closest match the issue:

https://answers.unrealengine.com/questions/376762/flickering-distance-fields-and-df-shadows.html

In summary, there is a limit of how much DFAO we can do per scene and your tree might be maxing that out! I get it on my foliage too.

Thanks for the link! The issue described there does indeed appear to be similar in nature. The console commands in the answer don’t appear to be working through, and since the black spots persist even if I set the meshes distance field resolution to 0, I wonder if it’s really an object tile limitation in my case.

Either way, I’ll try posting on answerhub as well and see if I can get an explanation there.

Please link me to the answerhub and I will vote!

Do the artifacts happen if you force full resolution DF?

Have you tried use self shadow bias for DFAO on the meshes? That might help. The other solution Ive used in the past is to make the tree leaves emissive slightly, which will help reduce the darkness of the DFAO.

Thanks for the advice!

That would be interesting to try, but I have no idea how to force full resolution DF and couldn’t find any documentation about it. Could you elaborate on how to enable that?

The self shadow bias setting doesn’t appear to have any effect at all, even at extremely high values.
Adding emissive color to the foliage material actually works pretty well to hide the issue. It’s a bit of a pain to get right for all lighting scenarios and time of day changes, but it’s the best solution I have so far. Thanks!

r.DFFullResolution 1 is the console command to enable full res distance fields.

Thanks! Doesn’t appear to make any difference though, unfortunately.

I’m really shocked this issue isn’t getting more attention! Everyone and their uncle is trying to make maps with vast terrains with trees, you’d think there’d be more people wondering why their trees are so blotchy!

Or is there a silly fix we just don’t know about?

I was wondering if the trees were uniformly scaled or not?

The screenshots I posted on the previous page are from a uniformly scaled tree. I have some non-uniform scales in my actual scene, but the issue appears to be the same regardless of the actor’s scale.