Download

ANyone know how to get rid of this shadow problem? (video in post)

I have blotchy shadows popping in and out in my tree canopy. I first assumed it was due to TSAA, and tried different buffer settings, then turned of AA all together, and found that it still happens. Then I messed with the leaf material itself… Lighting…shadows, translucency, etc,etc… No avail. It’s an autoplaced foliage.
Here’s a vid.

Any help would be most excellent.

I have had some issues with that when using instanced meshes. I could be wrong but I believe it has something to do with the way unreal batches the materials by default when they are instanced so it’s “culling” some of the shadows as you move around closer and farther away and those shadows that are culling are also attached to the trees in the distance, so they just pop in and out as if they were still close to you or further away if that makes sense.

I believe I solved it by increasing the shadow culling distance, so they just render continuously within that radius. I also had some weird artifacts when the lighting levels were too low, but the exposures were turned up and the materials just don’t render in places leaving unexplained blackness.

The culling distance can be a double-edged sword. If you have a single foliage asset that is within range of your character inside the culling distance that is instanced, but they are spread throughout the map, if I remember correctly, they ALL render the shadows and can be expensive on the GPU rendering things that are too far away to be relevant for shadows… Like a little plant that’s a half a mile away, but it’s unnecessarily casting fully rendered shadow. Hope that helps.

I actually found that If I paint them in with the foliage tool, there’s an option to turn off “cast contact shadows” … instantly fixes it… However, the trees that are auto-placed by my automaterial cant be effected by that option… unless there actually IS an option for it, hidden somewhere that I just can’t find for the life of me. >.< … I’d roll with hand painting, but my landscape is 128 km2… that’s a LOT of painting… lol… Although, it looks as if I may not have a choice…
EDIT : I was wrong… after I get a bunch of them together it still does it… Welp… Moving to your solution. See if I can manage to work with that. Wish me luck. lol

What are you doing the the leaf material?

Most common cause is the incorrect use of the local UVs / world position node.

It was a tree I downloaded. However, after having this problem, I’ve practically turned this asset inside out. I even completely gutted it down to just the normal map and diffuse. STILL happens… lol It has to be an engine/project setting that I’m missing. Still lookin… :confused:

So I had a post, but I just remembered that you can change your painted foliage, so I deleted it…

I don’t have to foliage painter pulled up to give you the exact steps but you CAN in fact apply the changes to the trees you already placed and I believe its a different brush, but you have to paint back over the area you painted the trees on and they should change.

You’re not actually repainting or moving any of the trees that are already there. It simply just applies changes that you made and you can change certain areas and not affect others. You can also adjust the offset to a random values and the trees will also have more variation to their placement. i.e. the trunk is further in the ground than others or you can make it so that the only the hill side trees are further in the ground and the roots aren’t sticking out of the ground.

They are defaulted to the base of the tree and they aren’t always far enough in the ground and you gotta change the offset to shove them down further. I think surprisingly Unreal Engine actually has good documentation on this in the foliage painter documentation.

IF the material has no world based stuff running on it, then the most likely culprit, in order of commonality are:

DFAO - because foliage usually needs special settings.
Cascade - because it’s the worse shadow system ever.
Light settings - because they can affect stuff differently (but it’s more likely to be a setring on the instance)

Check on those I’d other solutions don’t work.

Also, keep in mind that the engine version you are on could have a bug leading to that effect. Check with the release notes…

Well if there is shadow issues I would check your “indirect light” intensity. Bringing the light intensity up will usually land up blowing out the lighting but the use of indirect lighting intensity is how you can go about changing the shadow density. Try a very large value to start, something like 20, and back it down until you reach a good balance.

Another useful option is to make use of HDRI maps in the Postprocess volume to control indirect lighting with out having to rebuild lighting.

In the example there are only three light elements. 2 exterior and 1 interior and the PP controls the indirect lighting only as to filling the volume of space with a base.

Basically anytime you see indirect lighting that would be your means to control shadow depth.

Have you checked the translucency settings inside the material for the trees? There’s the basic level settings in the material’s general properties (the panel where the properties to set Domain, Shading Model, Lighting Mode, etc are located), but further down that list of properties is a bunch of translucency settings (Translucency and Translucency Self-Shadowing). The defaults may not work for your scene if they weren’t changed.

Foliage should never have transparency. It would cripple rendering down to less than a frame when you have a forest running…

Then how do trees and plants have translucent visuals up close, or get light going through the leaves and such? I think I have observed a number of posts from people using translucency mode for leaf and grass materials in the past.

People who don’t know how to properly use the engine, maybe.
Foliage has a specific shader mode which isn’t transparency.

Also, foliage isn’t transparent. With transparency you can’t have sub surface scattering.

As as the alpha value - masked materials are possible regardless of the transparency shader mode.

It looks like a problem I had when messing with lighting. I was messing with the skylight. I was trying to mess with the god rays and fog and I ended up screwing up the skylight.

Look here:

See about a quarter of the way down in “Stationary Skylight”, there is a building with 2 pictures. One on the left shows shadows similar to yours. The one on the right shows the dark shadows fixed.

https://docs.unrealengine.com/4.27/Images/BuildingWorlds/LightingAndShadows/LightTypes/SkyLight/0Original.webp