This week's update was all about the sky, with a dynamic sunset and sun being added to the game. You can watch my full dev log video about the skybox below, or you can read about the udpate in full under the video. Enjoy!
Main Features:
- Skybox: The main change this week is of course the skybox itself. It's just a cube rendered around the world and textured on the inside, but it make a whole load of difference to the look of the game! The skybox also rotates slowly to simulate the movement of the clouds.
- Horizon Fade: One problem that I faced when programming the skybox was how to incorporate the fog that I have in the distance. This fog allows entities and terrains to smoothly slip in and out of the draw distance. The fog only works if the fog matches the sky colour behind it, and this was tricky with the skybox being more than just one plain colour. To solve the problem I faded the skybox near the horizon into the fog colour, to create a plain background for the foggy entities to merge unnoticeably into.
- Dynamic Skybox Texture: The image rendered on the skybox can also change to allow for a day/night cycle. During the course of the day the sky can fade between different images of the sky, allowing for bight blue clear skies during the day, and stunning orange-y red sunsets in the evening.
- Fog Limit: Some areas in my game are foggier than others, and in the very foggy areas it simply didn't look right to see a clear sky despite the engulfing fog. So I allowed the skybox to fade into the colour of the fog, depending on how foggy it is, giving the impression that the sky is getting hidden by the fog. At a certain fogginess the skybox is completely hidden by the fog.
- Sun: And finally this week I added a dynamic sun to the game. The sun is simply a sprite texture of the sun which always faces the camera and is rendered just in front of the skybox in the position from which the sunlight is coming. The sun can also dynamically change colour and size during the day/night cycle. A bit of alpha blending as well, and Voila!
You can make the fog band be dynamic too! The way the guys at Wolfire Games (Overgrowth) did it is by sampling the skybox. Either blur the skybox until it's fuzzy enough to be used as atmospheric haze or just sample every pixel on the x axis as the fog goes up. You only have to compute the gradient once.