All about Sky in Unity’s HDRP
A good skybox can really set the mood and location for your scene, as well as adding to the overall color and reflection information. Together we will take a look at the different options available with Unity’s High Definition Render Pipeline (HDRP) when it comes to the sky.
I want to adjust the default volume that is open in the game scene, so let’s go find it. Start by navigating to Edit>Project Settings.
The Project Settings has a selection option to look at the HDRP Default Settings. I am looking for the default global volume profile assigned to the Default Volume Profile Asset.
Clicking on the Global Volume Profile asset will show me where it is located in the Assets folder.
After selecting the Volume in the Assets folder, I can see a lot of Post Processing options that can be adjusted in the inspector.
Let’s start from scratch and turn off all of these options.
You might notice that disabling the exposure will yield some dramatic results.
If your screen goes white, that’s because without the exposure, the game is using the intensity from the directional light, which is quite high.
Even with the light icon off and the scene view dark, my materials are still blown out.
Select the Directional Light in the Hierarchy and find the intensity option, under Emission.
The default setting is 100k, which is basically direct sunlight at high noon.
Dial it back to a value of 10 to see the game scene again.
That’s much better.
All of my post processing settings are now disabled and we are ready to make some sky!
I first create a new Global Volume in the Hierarchy.
The default Unity global volume profile is dragged into the inspector to assign it.
Enable the Visual Environment option and you will see the different sky options available under Sky>Type.
Let’s start by using a gradient for the sky. The Type assignment here just tells the post processing stack what kind of sky is currently being used. I still need to add an override to use the Gradient Sky.
Click the Add Override button, then choose Sky>Gradient Sky.
Enable the Top, Middle and Bottom channels to adjust their color. These work how you would expect with the middle being the horizon line, the top being the sky and the bottom being the ground.
Each one can be manually adjusted with a typical color picker widget.
The Gradient Diffusion option changes how close together the middle area is to the top and bottom. A larger value gives a thinner horizon line for the middle color.
Here I boost up the Gradient Diffusion value.
The is the change from a value of 1 to a vale of 20.
The thinner horizon line really pushes the depth of the game scene.
Colors can be quickly adjusted to give a drastic change to the scene.
A few clicks and suddenly we have a much warmer environment.
Your Intensity can be adjusted through Exposure or Multiplier.
You can also pick when the updates to the scene happen with options for On Changed, On Demand and Realtime.
This sample is adjusting the intensity via the exposure slider.
Physically Based Sky
This is a newer option for Unity and comes with a plethora of options.
Just like with the Gradient Sky, a new override needs to be added. Choose Sky>Physically Based Sky.
When your first option under Type, is Earth, you know there is going to be some great stuff in here!
The game scene already looks to have some very natural colors.
Turning on Spherical Mode and adjusting the Planet Center Position can yield some astronomical results, pun intended. -63781 is the actual default value of the Y axis!
You can see the planet leaving the game scene as I increase the X value.
What happens when I give a large value to the Z axis?
We get nice and interplanetary, hovering in a space station above the atmosphere.
This planet is lacking something…radioactivity!
A Reflection Probe cube map can be dragged into the Ground Color Texture assignment to give some radioactive results. You could also just use a normal ground texture if that’s your thing.
There is an option to Tint the color of your ground.
Then there is an assignment for your ground to have emissions. I put the reflection probe cube map back here because it’s readily available in the default options.
That doesn’t look safe at all.
There is a variety of options for Aerosols. The Tint, Density, Anisotropy and Max values can all be adjusted to your taste.
This gif is just increasing the Aerosol Density.
There is an option for Artistic Overrides. These mostly start at a max value of 1, and can be decreased. So mainly, this is an area to dial back these settings if need be.
This shows the Color Saturation moving from a value of 1 to 0.
Miscellaneous options give additional controls for lighting.
Last but not least is the HDRI Sky, which uses a cube map much like the Universal Render Pipeline.
Without a cube map assignment, or at least the default Unity HDRI sky, you will have this medium grey backdrop.
Add an override for HDRI Sky if there isn’t one already present. Here I assign the default Unity HDRI Sky cube map.
Again the exposure is experiencing a drastic change.
Dial the Exposure back from the default value of 13 to 1.
That’s much better. This Unity default cube map is fine, but I want to see some stars.
You can find out more on how I make this hand painted sky in Photoshop here https://jaredamlin.medium.com/how-to-create-a-custom-hand-painted-skybox-3dbd4506fe21
Start with a dark canvas.
Create a quick “star” brush by adjusting the Brush Settings on the default soft-edged brush. Changing the Spacing to 1000% will make dots when you draw rather than a line.
Now drawing makes these dots of the same size.
Under Shape Dynamics, I increase the Size Jitter to be 100%, which will randomize the size of each dot as I draw.
Now the dots have some much needed randomization to their size.
The Dual Brush option with increased spacing, scatter and count, will really make this job go faster.
A few brush strokes with a tiny amount of glow for a layer effect, and things are already looking pretty good.
I export a PNG, bring it into Unity and make it a cube map.
With the Global Volume selected in the hierarchy, I assign the new Stars cube map to the HDRI override.
The game scene shows the new cube map, which is looking a little unfinished.
Back in Photoshop, I add some dark blue to the background, give some stars additional size and glow, and make a ground texture. Here is the current PNG as it stands. I will have to revisit this and add some small mountain regions, clouds, and even a few moons. The options are as limitless as your imagination!
The PNG can be updated in the source file location for your Unity project. Then Unity will recompile and show the changes as you make them.
This is still a little dark, so let’s quickly brighten this up a little in Unity.
Changing the exposure in Unity from a value of 1 to 3 will give some good results, although a bit grainy.
The better option would be to make the Exposure adjustment in Photoshop and re-export a new PNG.
Here at an exposure value of 1.5, I think things are looking pretty good for an HDRI sky map that can be painted in 10 minutes or less.
Feel free to star gaze to your hearts content. Thanks for diving deep into the different Sky options in Unity’s HDRP. Remember to have fun in your own projects where the Sky is the limit!