Sunrise, sunset
Day/night cycles are something I have thought about for a long time. There's several possible approaches to simulating these, but it wasn't until today that I decided which is best. Here are some options I considered:
1. Shader-based skies with particle clouds.
This is the method Crysis employs. A subsurface scattering shader creates the sky background. The mathematics are pretty complex, but the results for an empty blue sky look great. Particle clouds are used to place sparse clouds in the sky.
Pros: Clear skies look great.
Cons: Not very good for overcast skies, clouds look worse than a skybox, expensive to render.
2. Animated skyboxes.
The idea is to animate a looping sequence of skybox animations for a 24-hour cycle, and interpolate between the nearest two frames at all times.
Pros: Potentially very high quality results, with a low cost of rendering.
Cons: Long rendering times to generate skybox textures, no ability to tweak and adjust skies.
The solution I finally arrived at is similar to the day/night cycles in STALKER: Call of Pripyat. A skybox with uniform lighting is used, so that it is not apparent from which direction the sunlight should be coming. The ambient light level, directional light color, fog, and skybox color are adjusted according to a set of colors for a 24-hour cycle. A large sun corona can be used to simulate the sun moving across the sky, and the directional light angle can be synced with the sun.
Pros: Adjustable and dynamic, easy to add new skyboxes, low cost to render. Skyboxes can be changed to alter weather.
Cons: Skyboxes with a distinct direction of lighting won't look good.
Here are some of my results using this method:
Of course, you are still free to implement any method you choose, but I am pretty satisfied with this approach for my own work, and I will make a scripted entity available to control these settings.
18 Comments
Recommended Comments