Create Environments Using HDRI Skies
Cinemachine and Timeline Final Framework Log 1
An environment is an all-encompassing area that surrounds your level or scene. Think of it as a skybox that forms a 360° wrap around your entire level, after all, are going to be using a type of skybox to achieve this.
Objective: Learn how to add an HDRI Skybox to use as an environment in Unity HDRP.
Table of Contents
· Adding a Global Volume
· Adding Overrides
· Using an HDRI Texture
· Add the Skybox/Cubemap
∘ Exposure Issue with HDRI Sky
· The Result
Note: This article is the first part of a log documenting my process to complete a Cinemachine and Timeline Framework assigned by my apprenticeship at GameDevHQ. The finalized version will be an animated spaceship scene with diffrent camera angles.
Adding a Global Volume
- For starters, I got rid of the default volume to start from scratch.
2. Add a global volume by right-clicking on the Hierarchy → Volume → Global Volume.
Adding Overrides
1. Create a new profile and add an HDRI Sky Override. Make sure you’re adding an override and not a Component, happens to the best of us 😅
2. Toggle the HDRI Sky, this should turn your scene gray, but no worries, we’ll have a nice sky real soon.
3. Add a Visual Environment override, this controls which type of sky the volume uses, without this Unity can’t tell the behavior it should follow when rendering your sky.
4. Make sure you set the Sky type to HDRI Sky in the Visual Environment.
Using an HDRI Texture
The most common types of materials used to create an HDRI Sky are HDRI textures and cubemaps. It might sound redundant, but HDRI textures have a different configuration that isn’t automatically readable, unlike Cubemaps. Unity reads HDRI textures as one continuous image making it look distorted, let’s learn how you can get past that.
- You can get some pretty cool HDRI textures for free here. You can also grab some in the Asset Store.
Once you have your HDRI texture in Unity, select it and go to the Inspector. You will need to change the Texture shape from 2D to Cube and toggle off the sRGB (Color Texture), these images are already linear and don’t need this extra toggle.
If you’ve successfully converted the HDRI texture to a cubemap, it should look like this in your project folder.
Add the Skybox/Cubemap
With our cubemap ready, you can just drag and drop it into the respective slot” Global Volume → HDRI Sky.
Exposure Issue with HDRI Sky
Let me pause for a moment and address this as it was the first thing I noticed when I added my space HDRI Sky. If you see red lines or squares when your skybox is added, it’s very likely an issue to do with exposure values.
I toggled on the Exposure Compensation to have a better dominion over my exposure values. You can also experiment with different exposure modes, but this fixed the issue quite nicely for me.
The Result
Let’s take a look around…
Everything should be working now!