Previously our programmer Martin talked about how the terrain is created. This time we want to talk about the environment and how we went about creating it:
First off, we set out early on to make a game that was based around cinematic, external views and this in turn necessitates having a believable environment as a backdrop for our ships and aircraft, and there are multiple ways to go about this, and which solution to choose is largely dependent on some key requirements set forth by your gameplay. The easiest solution and one favored by many games is to simply use high-resolution digital photography mapped on a hemisphere. It is a very old-school approach but it is very fast to render and can look very convincing. This is the approach I used in Atlantic Fleet and Cold Waters, where I spent considerable time sourcing the best-looking skies I could find.
In the case of Sea Power, it quickly became apparent that this approach didn’t cut it, for various reasons:
- In our game, combat takes place over hundreds of miles, with supersonic aircraft and missiles. Using a static panorama sky texture in this context means the illusion quickly falls apart as the clouds will very noticeably follow the camera as it moves over the ocean at high speed. It is possible to fake cloud movement with some clever UV manipulation (World of Warships and The Last of Us use this approach) in the shader, but again this does not work if the camera has to travel over vast distances.
- Aircraft in Sea Power may routinely operate at high (30.000ft) altitudes. This is clearly above most cloud cover, but this is not possible with a static backdrop.
- You will quickly find the same skies being repeated over and over if you play the game for an extended time. If you want more variation, eg: Night-Twilight-Dawn-Morning as opposed to just Night-Dawn-Noon you have to source complete texture sets for those times of day as well. If you have also need different cloud covers like in Cold Waters or Atlantic Fleet, the number of sky textures required grows exponentially.
So very early on in the development of Sea Power we decided that we wanted a dynamic sky system with a day-night cycle. The first thing we did was to write up a few key requirements:
- It had to look as good or better than the static sky textures.
- It had to be cheap to render.
- It had to work with the IBL lighting solution we use.
- It had to have clouds that could be seen from above and below.
- It had to be easily art-directable.
Our proprietary sky system uses a texture-lookup approach to seamlessly blend the sky as the time of day changes. The sky colors are provided in a panorama format for a given sun elevation interval, and then blended at runtime. There are quite a few different colors which all have to be set at any one time in the game, and having everything in a lookup-texture means that it can easily be edited in an image editing program such as Photoshop, significantly reducing the time it takes to tweak the look of the environment. The use of a panorama format means that one can very easily source colors from stock photography or other sources. Additionally, our system features accurate positions for the sun and moon based on time and geographical location, together making for a rather convincing result:
Clouds are an important component of any sky, and they can become surprisingly complex. We decided early on that we would have to be able to fly through the clouds, so this implied some sort of volumetric solution, and initially we did use a 3rd party raymarched solution, but this was slow to render and was incapable of creating attractive, fluffy clouds. We elected to use a classic billboard approach where clouds are clusters of billboards (basically 2d quads always facing the camera). This is fast to render but the end results provides for 3-dimensional, volumetric clouds. For creating the clouds, we use lookup-textures where each channel defines the size, height and type of clouds to use. This approach means the clouds are easily art-directable by an artist using an image editing program, and it is hence possible to author an arbitrary number of cloudscapes. To light the clouds, we use two sets of two colors and modulate based on the sun direction. We also project high-altitude clouds directly onto the sky, to create the multi-layered effect commonly seen on skies in real life.
We provide three basic types of non-inclement weather:
Overcast conditions are once again complicated by the fact that aircraft may operate above it. Obviously lighting conditions are much different below the overcast layer as opposed to above it. Overcast clouds attenuate and scatter the direct sunlight, resulting in a much softer ambient effect where a clear sky has very defined lit and shadow areas. Our solution is to have an additional lookup-texture with the overcast values, and blend between then based on the camera height. The effect is convincing and eliminates the need for complex realtime shadow-casting solutions which could quickly become expensive.
What better way to illustrate the effect than shoot a missile through the clouds:
As an artistic choice to make the overcast conditions a little more visually appealing, we retain some sunlight to act as a key light, and we let the sun shine through at the horizon during sunrise and sunset:
In the game, weather impacts sensor performance and detection as well as flight operations, so our environment system also renders inclement weather in the form of precipitation and lighting:
Hope you have enjoyed this post. Coming posts will focus more on gameplay mechanics, so stay tuned!
– Nils –