Foliage Static Mesh has no shadows

Hi there,
i painted some static mesh pebbles with the foliage tool onto my landscape, but they just do not cast shadows. In the picture below you can see my exact settings. Here some details to my issue:

The lightsource is a Directional Light (sunlight). If i set the light to Static or Stationary, i do not get any shadows at all. After setting the light to Movable, i got shadows, but i had another issue: The shadows fade very, very close to the camera (max. 6 Meters, i use the c++ 3rd-person template). I read all the shadow distance threads e.g.: [movable-mesh-shadows-gradually-disappear][1], [shadows-fading-out-with-increased-camera-distance][2],
but all settings there changed nothing for me. Probably because my lightsource is a Directional light?
The other problem i have with setting my light to movable is performance (if there is no other solution, fine, i take it, but i prefer not to).

Are there any settings i missed?
I really hope you can help me out, i’m out of ideas -.-

Hello Priareos,

I would be glad to help! So firstly go into foliage mode. Find the Static Mesh you are trying to cast shadows with and click on the button in the top right labeled “Show Instanced Settings.” Within that menu there is a drop down section where named “Lighting.” Here you can enable or disable shadows based upon those specific meshes throughout your entire level. Hope this helps!

Hi Andrew,

thx for the answer. However, the method you described was what i already did. The shadows were already enabled. But(!), i repainted all of my foliage pebbles and somehow they do have a shadow now, even though i didn’t change anything. They are barely visible though.
And the issue of disappearing shadows very near to the camera still exists. See screenshot (after 2/3 meters, green line).
I tried all the console commands in the threads i posted above, nothing changed at all. You can see the Directional Lights’ settings in the shot as well.
Any ideas?

One way to fix this would be to reset those cascade shadow maps to default. Also you should never need a Skylight on top of a Directional Light. It is usually either one or the other. Try deleting your Skylight and if this does not fix your issue let me know.

Thank you,

Resetting the cascade shadow maps to default didn’t change anything. Deleting the skylight did neither.
Also, why is it either one? Are you sure about that? The ‘Vehicle Game’ and the ‘Landscape Mountains’ project for example use both, and i myself really like what i achieve with both lights together. I don’t get the same results with either one of them alone.

You are actually correct and I am mistaken. Apologies.

You can use both, but one is for your dominant light (Direction Light) and the other is used as an ambient light (Sky Light).

The shadows seemed to be washed out which might be caused by your “Sky Light” being too bright.

Take those values within the “Cascade Shadow Maps” section and keep changing them until you notice a change in the way your shadows are being rendered when you move closer to the objects.

I know you have tried these before because this is what you are showing, but even the slightest changes in some of the values will give you the desired effect eventually.

If none of this resolves your issue let me know and I can help you with a different approach by using Ray Traced Shadows. This will require your light to be fully dynamic though.

Thank you,

Thanks for your effort.
My Sky Light intensity is set to 1. It isn’t really that bright. Turning it down didn’t increase the shadows.

I kept fiddling with the Cascade Shadow Maps settings, but the shadows always disappear quite near to the camera.

My foliage objects are quite small (maybe that is the problem), but it is still very visible that the ‘shadow view distance’ (or however you want to call it) is too low.
Aren’t there any global shadow settings, in which i can just increase the shadow view distance?

We can try the dynamic solution that you proposed though.

Cheers,
Priareos

Hey again Priareos,

So as soon you mentioned global settings, I realized I had not suggested trying to change your world settings. Changing something like your “Environment Color” can really darken your shadows. Check out these images to see the difference in my shadow tint and contrast.

White Environment Color

Black Environment Color

Keep in mind these are the opposite spectrum extremes, but if you choose a gray or something you will still get some darker shadows.

I hope this solves your issue!

Hi Andrew,

i tried your Environment Color solution, with no luck. My shadows get darker, but they still disappear very close to the camera. Furthermore, darkening the Environment Color darkens all my other assets as well, which is not an ideal solution…

Any more ideas :)?

Cheers,
Priareos

Hello Priareos,

I have exhausted all the options I know of that would help you improve your shadows. I would suggest continuing to try and balance the settings between your Skylight and your Directional Light. Perhaps even delete your skylight altogether to see if this resolves your issue.

Unless I have your project specifically I cannot move further with improving your issue. I would be happy to look at your project however. You can zip it up, if not too large, and post it here on the AnswerHub or Private Message me on the Forums.

Thanks,

Hello Priareos,

I was able to get your foliage shadows functioning on your map to a good degree. If you want darker shadows, change the light color of your Skylight to black. Skylight is used for Ambient Lighting, so when it is white, it tends to wash out the shadows and your scene in general. Also by increasing the intensity of your Directional light a bit as well you can get a nice contrast between your meshes and your shadows.

I increased the size of your foliage rocks to show you how the shadows have changed. I also noticed you have multiple types of foliage settings for the same mesh, which can cause confusion later down the road if you are trying to edit the instance settings of those particular foliage.

Here are some screenshots of what I was able to get by changing the Skylight color, increasing the Directional light intensity, and increasing the size of your foliage a bit.

Skylight Color Change

Directional Light Intensity

I suggest making sure you have all of your rocks on one foliage setting with a good min and max size range and density so you get the appropriate scattering and the correct random sizes as you desire.

Thanks again,