Lighting for Open World with Day/Night Cycle - Unity 2017
Hey all! I'm in the process of making a large-ish open world game (around 5km x 5km) with a day/night cycle, and I'm trying to learn the best ways to light this world. There are some static objects, but, for the most part, the world is pretty dynamic. Trees can be chopped down, grass moves in the wind, etc. The terrain can be static along with a few ground decorations, but that's about it. Even buildings can be created/destroyed.
I've been looking into all the lighting resources and tutorials I can find, but most of them are either lighting an individual, static scene, or they use Unity 5's Lighting window, which has a lot of options that I don't find in my 2017.3 Lighting window. I haven't been able to find much on lighting a dynamic, open world scene.
Does anyone have any tips or links to something I can read over to enlighten (ha) myself? I know lighting and post processing can make a huge difference in a game, and I'd like to learn and fine-tune all of that.
Posted Mar 19, 2018, 5:30 PM UTC · edited
If you want a day/night cycle you're almost certainly going to have to use realtime lighting exclusively. (You might be able to bake GI or inside buildings, depending on what you're doing.)
You'll need to create a manager script which controls the direction of the directional sun light - I tend to position the light in front of the sun (relative to the player) and point it directly at them constantly. Doing this makes adding visual representations of the sun/moon and sunshafts easy too.
Note terrains do not provide 2 sided shadow casting, so once the sun passes over the horizon you'll need to drop the intensity to zero to make it dark at night.
Speaking of which, nights usually will be far too dark unless you include a directional moon light, working in the same way.
With the ambient light, it's tempting to set it to Skybox and assume that'll be ideal, but it usually works out poorly, especially the color it gives from underneath. Instead get your manager to set the ambient mode to Tricolor, and control the ground, horizon and sky color as time passes. You can boost those dark nights a bit using that method too.
If you're handy with custom editors, you can use AnimationCurves and Gradients to set up a really nice set of controls.
All of these techniques have been used in this scene. In general, once you've got the manager in place it all starts coming together quite quickly.