Hey guys im having some trouble with weird black shadow artifacts on my static meshes that I can’t seem to figure out.
They appear to only be visible in hard to reach places like the underside of foliage and along the edges of things like branches or where my foliage and trees etc intersect with the landscape. It seems to only happen/be noticeable when the mesh is already in the shadow of another mesh.
It seems to go away when in direct sunlight but still shows up when using the “Lighting only” viewmode. The only things that I have found to make it go away is to set my sky light to static or stationary or to set “affects world” or “Casts shadow” to “false”. Switching the project to Lumen also fixes the issue but is unusable because of the performance hit. I’ve attached some photos of what it looks like.
The strange thing is that it seems to get worse as time goes on for some reason.
Also, In my foliage master material I have a “Switch Parameter” that can be used to switch between using the normal map of the foliage or just a plain white vector4 constant. I used this originally because it seemed to lessen the amount of shadow artifacts on my foliage.
While testing I toggled this switch parameter to true and then back to false on one of my foliage instances material instances, and now the problem has suddenly gone away on All affected meshes, but I know it will slowly come back. Am I missing some setting that is caching these shadows or something because it would seem that toggling that switch cleared something. Im using the regular shadow maps not virtual shadow maps, no nanite and no lumen.
Thanks for the idea but it doesn’t appear to be anything to do with ambient occlusion as when I disable all my post processing it doesn’t go away and when I am viewing through my ambient occlusion buffer visualization everything looks normal. I think it has something to do with Global illumination or distance fields or something as when I change to lumen the artifacts go away. It seems to happen only where there might actually be occlusion of the light rays not being able to reach so well so they’re just left with ugly dark shadows. When im not using lumen the only thing that I can find that actually affects it is my Realtime capture based sky light, where setting “Casts shadows” to false or changing mobility to static or stationary will remove the artifacts but that also removes all distance field shadows etc.
I believe I have fixed it. Or at least come up with a fix that makes it not noticeable. I have turned down my suns directional light intensity. I have lowered the suns intensity to that the shadows are a similar darkness/depth as they are when I am experimenting with lumen. This makes the shadows way darker and more realistic looking but also makes it near impossible to see the artifacts I was getting. I guess the light was so intense that it was lightening up parts of my foliage that shouldn’t have been that well lit and was leaving me with these high contrast looking shaded areas. It might just be a janky work around but for now it has made a massive difference
It’s still happening, but the strange thing is that it gets worse and worse the longer you have the editor open. The more you work on the project the worse the effect gets, it happens when you work on stuff like changing material instance properties. it just progressively gets worse like there’s a memory leak or some kind of weird caching going on over time. It feels like an engine bug more than some kind of setting to be honest.
I restarted the editor and at first when it loaded up the black artifacts were there but almost non existent.
Then all I did was look at a few different tabs I had open during my last session. They were material instances of my fern foliage. I didn’t adjust any of the parameters, I simply clicked on the tabs to see what they were. Then I dragged a couple of these material instances into their own separate window like I normally do if I want to adjust some parameters to watch their affect in realtime via the main level viewport.
Then the shadow artifacts grew exponentially. No adjusting of any values, just flicking through a few tabs and opening a new window. What the hell kind of bug is this??
Like I said previously it just gets worse over time, I guess as I flick through different tabs while im working.
Any ideas would be greatly appreciated. I’ve had this problem for quite some time but have only recently decided to try fix it so I don’t think its a problem with the engine version or anything.
if I turn off cast shadow in the foliage instance it still shows up. Same as when I turn off casts shadow in the directional light(Sun). It still shows up when I use “scene color” viewport mode. The only time it goes away is when I disable “casts shadows” in the levels sky light component, but none of the other settings in skylight component have any affect on it except if I brighten the occlusion tint. But that obviously ruins the ambient occlusion of everything.
if If I turn down global illumination to low in engine scalability the artifacts go away but so does the shadow quality etc. Anything higher than low and it comes back so would be interested what setting is disabled on low but enabled in all the rest
EDIT: I believe it disables distance field ambient occlusion.
Hm. Maybe it has something to do with Distance Field Ambient Occlusion. Try altering the distance field self shadow bias setting, or try disabling effects distance field lighting.
Mesh distance fields are static, but foliage often has WPO animation. As the leaves blow in the wind, they can intersect with their own distance field and cause a self shadowing artifact. Perhaps that is what we’re seeing.
It’s much more present when the foliage has WPO than when it is disabled. The artifacts are still present just exponentially less.
I disabled “affects distance field lighting” on all my foliage and it reduced the artifacts by 95%, but the strange part is that I’ve already tried turning that setting off at least half a dozen to a dozen times and saw no noticeable difference.
Now setting it to false does remove the artifacts, BUT when I set it back to “TRUE” the artifacts remain gone.
Which is good but also makes the problem very elusive.
For now, toggling “Affects distance field lighting” on all my foliage ISM’s from “ON” to “OFF” and then back to “ON” again has fixed it. I did change my shadow bias but saw no noticeable difference so set it back to its default that it was on.
So maybe one of those two settings was bugged in my engine and toggling one of them or both fixed it?
For now the problem has gone away
It was definitely distance field ambient occlusion related though so thankyou very much for your help BananableOffense
I will keep update this thread if the problem comes back or I find out more information on what’s been going on but at the moment It’s looking like a bug
Nevermind, it’s back as soon as I open up my project again or tweak anything. This has to be an engine bug of some sort. It randomly comes and goes without rhyme or reason. This time I disabled the WPO on my master material for one of my foliage types and applied the material and it mostly went away, then I reconnected the WPO wind effects again and applied and the shadow artifacts stayed away, but then as soon as I start working on other stuff it comes back again. It’s definitely associated with distancefieldAO but none of the settings that control distance fields or AO seem to do anything. Might have to submit a bug report if someone can’t ride in and save the day