Landscape directional light + shadowing issue
I've taken a few screen shots that demonstrate the problem I'm having with the incorrect shadowing on the landscape during a sunrise/sunset. I've seen a few people with the suggestion that the light must be turned off at night; this does not solve my problem. The problem is the landscape shadowing at ~7-8 AM, not midnight. This problem occurs with two-sided-shadows enabled on the landscape.
TLDR: Picutre 1-3 shows incorrect lighting on the landscape, picture 4 shows correct lighting.
As you can see in this first screenshot, early dawn the landscape starts to reflect light that is coming from below the landscape. The landscape has 2 sided shadowing, but either way, the top face of the landscape shouldn't be getting lit. Yes turning the light off here would stop this problem:
Here in the second picture you can see the effect get intensified as the sunrise progresses. If the light was turned off here to fix the landscape lighting issue, the sky wouldn't have the sunrise effect. So disabling the light is not the solution:
Here in this third picture, this is the apex of the sunrise, the furthest into it while the landscape is lit wrong. Again, if I had to turn off the light to fix this problem, there would be no sunrise.
Finally here in this final picture, at a certain point during the sunrise, the angle just gets to a certain level and then the landscape stops its weird lighting/shadowing. This final picture is how the landscape should appear, it should not be lit like the previous 3 pictures. And again, the problem is not light coming through the landscape at midnight, it is only in the dawn/dusk hours that this occurs, and turning the light off up until picture 4 would remove the entire sunrise effect up until this point.
I had the same issue when I did my own system. The solution is simple and I realized what was going on thanks to the mountains on the edge of my landscape. The light goes through the 'down' side of the landscape, because there are no faces to block the light. So, when there was sunrise and I had a mountain on the side where the light came from, the shadows were incredibly distorted and some areas were lit, while they should not be.
The simplest fix is to model a staticmesh that perfectly matches the lower side of the landscape, like a ground beneath the ground, with it's tris faced downwards (normal pointing down). It could be a plane, but then it would only fix the issue during the night hours and the sunrise/dawn would be still broken.
Make the mesh hidden in game but cast hidden shadow, no collision and everything will be fine. You could also try going with 'Shadow Two Sided' on the landscape, or similar option in the landscape material, but I'm worried that this could be a possible perf killer for something as big and occupying space (pixel shaders) as landscape so I went with fake shadow caster solution.
I'd like to know what works for you ;)
Follow this question
Once you sign in you will be able to subscribe for any updates here