Moon and Fog
In SunSky add Directional Light and name it as MoonLight.
Set intensity to 0 and temperature to 4000.
Add arrow and drag it in MoonLight.
Add Spring arm and drag it in Arrow.
Rotate Spring Arm 180 degrees, set arm length to 50000 and disable Do Collision Test.
Add Exponential Height Fog.
Copy the values from below.
- Fog Density 0,05
- Volumetrig Fog Albedo is #4C4C4CFF (linear)
- Scattering Distribution 0,9
- Extinction Scale 15
- Hidden in Game denabled
Increasing Extinction Scale the fog gets thicker. You don’t wan’t to touch anything else.
Add Sphere mesh and drag it in Spring arm.
Disable collision and cast shadows.
Create Material for moon and…
use material instance of it.
Go to UpdateSun function, add SetWorldRotation for moon light after directional light rotation. Use Directional Light rotator and invert the face so the moon is pointing from opposite side of sun. Even though that is not moons path in real life.
SetMoon event comes here and it changes scale and distance.
Continue SunIsDown event by adding the rest:
You may notice a small jittering or lag, when sun is up, sometimes shadows jump back. This is because a massive static mesh is moving every frame. It’s basically just spam. Even though the Moon is set to Hidden it still does this. If you find BP_Sky_Sphere blueprint from Engine Content and open it you’ll see that SkySphereMesh mobility is set to static. We don’t want massive objects to be movable. So the only way to fix this is to create Sky Sphere and Material where we have a Moon texture moving on the surface.