In this article, we are going to cover how to create two different types of skies in Unity’s High Definition Render Pipeline. The first sky will be an HDRI sky, which uses a high definition image’s ambient light to light the scene. The second sky is a gradient sky, which allows you to choose and blend 3 colors to create the sky. But first, you will need to create a global volume to create any sky.
In Unity’s High Definition Render Pipeline use volumes to add post-processing effects to the entire scene (Global) or part of the scene (Local). We are creating a Sky, so we want to create a Global volume since the sky will effect the entire scene.
When you create a new Volume it will create a dedicated game object for this volume. In the Mode, set it to Global and we need to add a new Volume profile which allows us to add post-processing effects. Adding the Overrides in the green box below is Unity’s default Volume Profile, but to create a sky we will need to add another override.
To create a Sky, you will need to add a Visual Environment to either add an HDRI sky or Gradient Sky.
In the Visual Environment, select the HDRI sky and for the Ambient Mode we will want to use Dynamic. Dynamic will get its ambient lighting from the HDRI sky, instead of Static which will get it from your Directional Light.
We will need to add a HDRI sky override to be able to control it.
The HDRI Sky requires a cubemap and there are a ton of HDRIs you can download from Poly Haven.
When the file is imported into the project we will need to change the texture shape to cube and mapping to cyclindrical.
Now we can assign the HDRI and again use dynamic to make use of the ambient light from HDRI Sky.
We can adjust the Exposure and Rotation of the sky as you can see in the image below.
Lets create a Gradient Sky, so going back to the Visual Environment in our Global Volume we will change the type to Gradient and keep the Ambient Mode at Dynamic.
We will need to add a Gradient Sky override which will allow us to control its properties.
The Gradient Sky allows us to pick the Top, Middle and Bottom colors for the sky.
The Gradient Diffusion will control the blending between those three colors and again the Exposure will increase the brightness of ambient light from the sky.
The image below you can see the three levels of light, the gradient diffusion and the exposure being changed.