How to set a custom Skybox in Unity!
There are four ways to add a custom skybox in Unity when either using the standard or the universal render pipeline.
- 6 sided
I will go through each one and show you how you can use them effectively.
First, we need to create a new material.
Create a folder in your Project panel and name it “Materials.”
Create another folder inside “Materials” and name it “Skyboxes.”
Inside the folder, create the new material by right-clicking and going to: Create > Material.
Name the material “Skybox.” When selected, above, in the inspector, there’s a dropdown element where you can choose the type of shader/material it is going to be. If you look inside the dropdown, there is a section for skyboxes. This is where you can choose the type of skybox you want. It all depends on how the skybox images are constructed.
Then you are going to want to reference the material in the “Lighting” panel, under the “Environment” tab. There’s data that accepts “Skybox Material.” Drag and drop the skybox material into the reference box.
The scene won’t have any changes until we mess with the skybox material!
If you have six individual sky textures that can be stitched together, use 6 sided.
Add the Textures to their proper axis and we should have a nice looking skybox!
The cubemap is similar to the 6 Sided option. The only difference is that all of the images are in a large image file.
With this in mind, we need to adjust the image in the inspector. We need to change its texture shape to Cube.
Then we drag the cubemap image to the skybox material where it asks for a cubemap!
Cube maps are easier to make considering how it only takes an image with 6 skybox images unwrapped.
Panoramic is what it is! A skybox that wraps around the scene spherically.
Panoramic shots are usually in .EXR file type which means it’s a High Dynamic Range image. Select the skybox material, change the skybox type to panoramic. Then drag and drop the image into the “Spherical (HDR)” reference in the inspector.
This option does not require any textures at all! You can adjust the skybox properties from the material itself.
You can achieve amazing results when messing with the settings.
In the “Lighting” panel, there’s an option to reference the “Directional Light” to the “Sun Source” so that it can be controlled via the scene.
Just drag and drop your light source from the hierarchy to the sun source. Now we can mess around with the light source in the scene and see the changes!
Now that we know how to set up and create custom skyboxes in Unity, we can make our games more beautiful!