Why does my Sun still light objects at night time?

The lighting is fine in the morning

But when it turns night time, the sun is still lighting up the trees when it goes down and it looks awful.

I Tried building lighting many times and i have no idea how to fix this. i even checked if the landscape was casting shadows and it said it was casting “Static Shadows” no option for dynamic shadows though. Can someone please help me out?

Is this for dynamic or static lighting?

If it is dynamic, expecting dynamic shadows to shadow the entire scene for night time is a bad idea even if you get these artifacts to go away. You will pay a huge expensive for a black result. I would suggest that you use a timeline or blueprint script to simply fade the brightness to 0 when the sun passes under the horizon.

Looks like landscapes no longer have an option to set two sided shadows. That is probably what is causing this. I will follow up with people on our end and make sure that gets bugged.

Oh ■■■■ i totally have an idea… what if i put an object UNDER the landscape and the object will recieve the light and cast a shadow on the trees instead of casting light.

So is there any way i can fix this?

How would i add a timeline to make the brightness go down to 0 when the sun goes down?

Hi gotgrassct,

This tutorial on the wiki goes through using an event tick to alter lighting, but also links a timeline tutorial for simulating time of day: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

You could place a big “blanket” shadow caster under the whole landscape.

Where are you updating your sunlight rotation form? Anywhere that you are doing that updating you should be able to easily calculate when the sun is below the horizon by doing a dot product with (0,0,1) and the light’s Xvector. I think it will return 1 when the sun is at noon and 0 right when the sun is below the horizon, and -1 when it is at midnight. Then you could easily use some math to isolate the blend to off at the right point.

I’ve added the option to allow Landscapes to cast shadows as two-sided. This will be in the Unreal Engine 4.3 release.


THANK YOU! Now i can make my horror game. thank you so much, . Also, do you know when 4.3 will be released?

We are branching 4.3 from Main this week, and we hope it will be released some time in mid to late July.

FYI if you’re using source code, the patch is here. It should be very easy to integrate.

Really though you should disable the directional light if it is coming from underneath, you don’t want to be paying all that dynamic shadowing cost for an invisible light.

Another fix is to add a hollow BSP cube and place whatever should not be lighted inside it.