I have a day-night cycle in my game where the Sun (directional light) rotates around a point. I’m running into an issue though where when the sun goes under the horizon, the light is coming through my terrain mesh and lighting up the bottom of my buildings and trees. I have tried putting other objects such as large cubes or reversed planes underneath my terrain to try to block the light but this did not work.
Here are some pictures. In this first image, you can see that the directional light is under the terrain pointed up at (0,0,0).
This is what it looks like from the game scene:
If I turn off the light you can see the bottom of the trees not lit up anymore.
I’ve tried turning off the light when it reaches an angle of 0 degrees to the horizon but this caused the lighting to look jumpy and I didn’t like the results.
Does anyone have any suggestions on why this is happening?