Hey guys.
So for the last few weeks I was trying to implement my own day/night cycle in UE4 using Blueprints, but unfortunately I faced a few problems. After trying out different solutions I was just faced with different problems. My goal was to create a dynamic sun circle using a dirLight as my sun and cascaded shadow maps for shadows (no distance field fanciness) and a realistic looking dynamic skybox (achieved via the atmospheric fog component)
The first problem I faced was the light bleeding at night. The sun was shining from beneath my terrain. I tried shading the terrain as two-sided but the light bias was enough to make the bleeding look ugly, and reducing the bias would be a terrible hack indeed. So I was forced to turn of the light intensity over time at sunset and sunrise, which in itself would not be a problem…
Which brings me to problem no 2: Turning of your primary light source also disables the atmospheric scattering effect of the fog component. While this technically makes sense it is terrible for artists that want as much control over a scene as possible. So I tried to wiggle my way around this restriction, by setting the light to invisible, hiding it ingame and even trying if you could “fool” the fog to taking another light source, but it was all in vein…
So I had only one option, to use my own skybox material. But that’s easier said than done… The default BP_Skybox that UE comes with looks terribly artificial to me, and while I could implement the atmospheric scattering shader myself it would probably take a pretty long time.
So, after all, I settled on the solution of turning the brightness of my sun light down to 0.01 while multiplying the sun factor in my fog component appropriately. But that again seems like a bad hack to me. Is there a way to make all this cleaner? Maybe even poke into the source a little? It seems to me the user should have a little bit more control over some of the given components…