The Complete Guide to Skyboxes for Unity
November 16, 2022
What is a Skybox?
A Skybox is a material, texture, or visual effect (or combination of materials, textures, and visual effects) that enable game developers to include clouds, stars, skies, moons, or even distant level geometry in a game level. This tool helps players to feel like they are in a much larger play-space than they make actually be in. The most basic skyboxes are represented using a simple 2-dimensional texture known as a cube map. This cube map skybox texture is then sampled using a skybox shader that re-maps the 2-dimensional data across the spherical area surrounding the play space. Typically, the skybox is rendered quite early on in the render queue - ahead of geometry, opaque, and transparent passes - but it can be rendered after geometry or opaque passes to enable the skybox shader to avoid overdraw. Players can never "go into" a skybox, but there are techniques that enable developers to simulate 3-dimensionality and parallax effects even in 2-dimensional skybox environments. Apart from that, developers can also introduce volumetric rendering techniques in order to simulate clouds or other atmospheric elements.
At OccaSoftware, we have created two different types of skyboxes for Unity. Altos is a powerful sky system and dynamic skybox for Unity that includes volumetric clouds, a procedural skybox, a day night cycle, and night sky rendering. Super Simple Skybox gives you a straightforward material for a dynamic skybox with dozens of parameters and a sleek user interface.
What are the different types of Skyboxes for Unity?
Developers have invented several clever methods to represent skybox data in Unity, but at the end of the day, there are two main types of Skyboxes: static skyboxes and procedural skyboxes. Most Unity skyboxes fall into one category or the other, though some developers have integrated the two. For example, you might have procedural elements (like volumetric clouds) overlayed on a static cubemap skybox.
What is a Static Skybox?
A static skybox is typically a single 2d texture representing the complete sky and distant geometry state of a game level. Photographed static skybox textures are also often referred to as an HDRI, or a High Dynamic Range Image. You can download free HDRIs from a ton of sites online, including PolyHaven, Textures.com, and HDRMaps.
Typically, a static skybox is authored outside of the game engine, then converted to the appropriate texture format expected by the skybox shader, and then rendered by the skybox shader. Skybox artists may combine several textures together in external tools (like Photoshop or Gimp) and may combine the 2d background texture with other visual effects or 2d textures. For example, the skybox artist might also take some photographs of clouds, edit them in Photoshop, and then bring those clouds in to the skybox environment as static 2d sprites.
Artists can also include transparent layers to simulate distant fog attenuation or other similar effects. Static skyboxes are most often used in cases where artistic direction is highly critical and there is a single fixed time of day or fixed set of times of day that can occur in a given scene.
What is a Procedural Skybox?
Procedural Skyboxes are somewhat more complex than static skyboxes, and as a result often have corresponding higher performance cost. A procedural skybox is often a combination of shader wizardry and 2d or 3d textures combined. Most often, the technical artist would use the main directional light (the sun) along with perhaps a second directional light (a moon) in order to describe the time of day, and then use that time of day as an input to a set of algorithms that result in a color fragment for each pixel on screen (i.e., each pixel on the skybox). For example, the technical artist could expose a set of parameters such as the horizon and zenith colors of the skybox at different times of day, and the designer could use these parameters in order to describe how the particular procedural skybox material should respond as the directional light moves through the sky and the time-of-day changes.
Although this does give more flexibility by enabling the designers to easily change through different times of day (or have a completely dynamic time of day system), there are other considerations to keep in mind as well. When the time of day and light position changes, you will need to re-bake any static lighting in your scene. Re-baking this static lighting is a performance intensive process, so you would likely need a dynamic baking system, or a dynamic GI system integrated to your project to fully take advantage of these benefits.
Complete Sky Systems vs. Skyboxes
Some developers opt to use a complete sky system as opposed to a standalone skybox. While a skybox is often good for more static scenes, a complete sky system will give you more realism along with integrated day/night cycles, stars, moon support, and so on. At OccaSoftware, we have developed skybox solutions to fit either need.
Altos vs. Super Simple Skybox
Altos is our complete sky system for Unity. This game asset includes a highly customizable procedural skybox as well in addition to standalone volumetric clouds. Altos also features a configurable day/night cycle, stars, a 3d moon, distance fog, and skybox clouds. We typically recommend Altos for game developers looking to create a game with a more complex, realistic sky that is internally integrated. Altos is only available for Unity URP and is currently targeting Unity Editor 2021.3. We've put together a tutorial for Altos demonstrating all the features included in this sky system for Unity.
Super Simple Skybox
Super Simple Skybox is our straightforward, easy to use and integrate standalone procedural skybox for Unity URP. This asset features a dynamic skybox that responds to changes in your main light position. It also includes a procedural moon and sun along with star textures. It also features beautiful skybox clouds rendered using innovative UV-remapping techniques that allow you to display clouds directly overhead - something that many procedural skyboxes do not have. However, Super Simple Skybox does not include volumetric clouds, 3d moons, distance fog, or a configurable day/night cycle. You can see Super Simple Skybox in action on our YouTube channel.
Which skybox is best for me?
We typically recommend the Altos complete sky system for more ambitious projects featuring better graphics and targeting console or PC hardware. It's really hard to beat the beauty and realism offered by our volumetric clouds with any 2d skybox solution. On the other hand, Super Simple Skybox is perfect for smaller projects targeting mobile or lightweight hardware. This asset also provides a high level of customization on the procedural skybox itself, so it is great if you want to focus on that area.
Other assets to complete a skybox
We highly recommend using two other important assets to help complete your game's skybox environment. The first is a Volumetric Fog rendering solution. Volumetric Fog is essential to helping ground your environment in the scene. We think that Buto, our in-house volumetric lighting and fog solution, is the best pick here ;-).
We also strongly recommend an Auto Exposure asset. Auto Exposure is a post-process rendering feature that dynamically adjusts a scene's luminance in order to maximize the scene's visibility. This is also called eye adaptation, because it simulates the way that the human eye dynamically adjusts to changes in brightness in the environment. This type of eye adaptation asset enables you to ramp up the dynamic range of your scene and let your sky really be a major player in your game. Our personal favorite is also an in-house pick - Auto Exposure for URP.
Want to learn more about sky and volumetric rendering?
We've compiled an extensive list of resources on sky rendering and volumetric rendering to help game developers like you get a head start on the basics and dive deep into the details. With 50+ links to detailed resources on rendering techniques, noise generation algorithms, signed distance field calculations, ray marching concepts, and more, our resources document is the best place to start to learn more about volumetrics.