[HELP] Sun shines under the landscape - Day/Night cycle WIP

Hello, I"m working on a day and night cycle for my game. As you can see in the video provided below, the sun and moon are almost set (moon at 20% of progress), but I have an issue while the sun goes down the horizon, my meshes are illuminated upside down. Disabling the sun (direction light) intensity will not work due to the moon phases (affected by the sun’s directional light). Two sided shadows in the landscape details is set to on.
Have some of you any idea of what’s going on and how to fix it?

Essentially your meshes are one sided, especially the landscape mesh, which is causing the directional light to shine through as the night cycle runs. There are multiple ways to fix this actually, you can do the cheap easy fix for small landscapes by placing a simple box mesh under your map which will cause the light to be blocked. Another way is to build a blueprint system that turns the intensity of the light to 0 when reaching a certain position in the sky (horizon). I am not sure about specific blueprint cases but I have seen them in the forums and on example files.

I already made the intensity blueprint that switch on and off the sun intensity while hitting the horizon, but setting the intensity to 0 works, and than this is current but I need to use the intensity because my moon I’m working on is affected by the Sun intensity (full moon, half-moon etc).
I tested this second method… the easiest one with that cube, worked directly as it should be working. I don’t know why it didn’t work few days ago, perhaps I changed something somewhere, or I’m already too tired.:slight_smile:

But isn’t there a more advanced method for handling this sun issue?

You need to place two Planes, one for sunrise and one for sunset, both must point towards the direction of the sun to cast the shadow, also if you have mountains on your horizon this will cause the sun to filter under the other face from your lanzcape, to these landzcape that allow sunlight to pass through, activate Two Sided on the Material.

Place a box instead.

In a cycle the sun rolls all the way around so it will be perpendicular to the terrain too.

Also, the cycle needs to set the light intensity to 0 for night time. It doesn’t solve it all, but it’s a good start.
Add a different light channel exclusive for the moon so it only affects the moon and nothing else.

The box is still required to prevent things - like tree meshes that poke through the landscape - from being lit anyway.
Particularly if using a re-captured Sky light…

It works perfectly for me as I explained above, obviously the sunlight must be deactivated at night, otherwise the sunlight would be seen from below. I see it unnecessary to use a box but it is also valid. The box would only be necessary if the sun would continue to emit light at night, but this would be a bad idea in terms of performance, unless it is a project requirement.

Like the OP said, there are certain situation where the light is a must and there still has to be a shadow cast onto the underside of the terrain.

Also, a box is 1 drawcall. The 2 meshes are 2 drawcalls and have a high margin of error.

The height of the mesh would need to be as long as the sun declination ratio to the landscape length.

With a box, you use one drawcall, and it can be 1m tall without having to do anything at all.
It’ll just cast a shadow into the underside, no matter what