Foliage does not recieve lighting from Landscape?

Hi all,

I’ve been working on some grass for a project. I’m using the foliage landscape tool to paint the grass onto the landscape. While doing so, I’ve found my grass looks better and is more performant when I disable “Cast Dynamic Shadows”. Unfortunately when doing this, it seems like it also disabled them from receiving shadows properly from the landscape mesh itself, but not other actors. They will still receive shadows from other static meshes perfectly fine. Is there a certain setting to modify to let the grass receive shadows from the landscape, but not actually cast them themselves?

Screenshot to help explain issue:

grass shadow.jpg

In addition to those settings, I’ve also tried disabling “Cast Shadows” from the static mesh actor of the grass and enabling “Cast Dynamic Shadows” from the landscape foliage settings, but that didn’t seem to make a difference.

Anyone have an answer for this?

Check if your landscape has dynamic shadows enabled. From the tabs on the left select landscape/manage/selection tool and select the landscape. This will bring up a whole lot of shadow settings in the details tab wich are not there if you just select the landscape from the world outliner.

also try r.shadow.maxresolution 4096 to see if it changes anything.

Unfortunately this didnt seem to change much.

Also dynamic shadows are indeed enabled, and actually if I paint a hill big enough, the shadow does start working, but unfortunately on these smaller little hills the effect isnt really visible on the grass mesh at all, unless the hills are (almost abnormally) large. This makes it a little difficult to get the exact affect of blending im looking for with lower hills… hmm…

are far shadows turned on for the landscape?

are you sure that your light angle is actually shallower than your hill slope? If the light is steeper than the hill, there will never be shadows cast on the grass like that. I don’t see the landscape shadowing itself which indicates your angle is not low enough for it to happen.

try r.shadow.csmdepthbias to various amounts. Probably is just the bias. if your grass is very small (ie, under 10cm tall) it could have issues.

Here is what I mean. From your images it looks like your sun is an angle like the blue line, nearly parallel to the steepest part of your hills. They won’t cast shadows unless the sun is actually at a lower angle than your terrain slope, like the orange line:


your rocks cast shadows because they are much taller than either line relative to the hill.

Yeah I have a feeling that it might be just the light angle unfortunately.

r.shadow.csmdepthbias didnt do a whole lot when using different values. The grass is small, but not super small (prob around 50cm).

The biggest issue is that from far away, you can easily see the landscape is slightly shaded/darkened (but not fully casting entire shadows), but the grass is not, which makes it look pretty inconsistent, which you can see pretty easily in this picture here:

I’ve definitely got the blending along with the lods working a lot better since the picture, but its still visible… could there be a way to shade the grass a bit more thats in that “slight” landscape shadow?

At this point I dont think its incorrect lighting at all, but still, it would probably look nicer if I could get the grass to blend more with the landscape color in those areas.

That isn’t a shadow problem, its a problem with normals not matching between your grass and your landscape. The landscape gets darker on the hill backsides just from the N dot L part since the vertex normal is almost 90 degrees to the light. Your foliage looks to be doing something else and not using the terrain normal.

You can set the grass to use the vertex normal of the terrain for lighting to see how much that helps. Make sure they align to normal and then simply use the up vector transformed from local to world space as the normal (ie 0,0,1 local->world vector transform). most likely you want some combination of the terrain vertex normal, some texture normal.

This part of the tweaking process is very delicate. I spend a ton of time tweaking this aspect of foliage and terrain. There is really no way to automate that kind of level of polish, since you might not always want to use the vertex normal for the foliage. For some things it will look bad.

make sure to set “b tangent space normal” = FALSE in material settings whenever doing world space normals.

Thanks for the help! I did a few things and its starting to look much better. First thing I did was edit the normals in max and made all the normals point up. Next thing I did was follow your advice and used a vector of 0,0,1 and transformed it to world space and plugged it into the normal of the material, and wala, they are almost perfectly shaded now with the landscape. Edited it slightly and multiplied the grass nornmal texture by the up vector and still looked very good.

Heres an updated pic:

Now starting to get that slight shade :slight_smile: Will have to keep playing around with it a bit, as I think there is definietly some room for improvement (esp. with the LOD’s), but its looking much better.

Looking fantastic, great work!

Working for me too :slight_smile: thanks

001 local2world always returning 001 on foliage, working on static meshes in ue 4.24