How to change Skybox in Unity with a 360 IMAGE

Introduction – What is the Skybox in Unity?

The Skybox is like an image that completely surrounds a scene in Unity and remains fixed no matter how hard we try to get close to it. The purpose of the Skybox is to represent the distant horizon of the scene and it is possible to choose a texture to do so. In this article we will see how to change the Skybox that comes by default in Unity. This will allow us to customize the skybox for our game.


First Step – Get an HDR Texture to use as Skybox

To modify the Skybox of the scene we will need special textures, one of them is the HDR (High Dynamic Range) textures, they are textures that have more information than the ones we commonly use and they are useful to illuminate scenes, because you can increase or decrease their intensity and the texture responds properly.

I usually download textures from the HDRI Haven page, they have a quite interesting gallery with this kind of images, the downloads are free and you can also choose between qualities ranging from 1K to 8K textures, as you can see in figure 2.

HDRI Haven

Fig. 1: First you need to get an HDR texture, on the page there are different categories and they can be downloaded in different resolutions.
Fig. 2: In my case I downloaded a texture in 2K resolution.

How to change the Skybox in Unity – Step by Step

Before showing the complete process I will put a list of steps to summarize the process, if you already have experience with Unity you may find it useful.

1. Import the HDR texture into Unity and in the inspector set its “Texture Shape” parameter to “Cube”.

2. Create a new material and set the Shader type as Skybox > Cubemap.

3. Assign the HDR texture to the “Cubemap HDR” field of our material. With this we have the Skybox ready to use it.

4. Go to the Window > Rendering > Lighting window, Environment section and in the Skybox field select the material you have configured in the previous step.

5. (Optional) If the texture does not have good quality, modify the compression format or download a higher resolution HDR texture.

Detailed procedure on how to change the Skybox in Unity

Once we import the HDR texture into Unity we will create a new material, in the Assets folder, right click, create and then select material.

Fig. 3: We create a material to make the Skybox.

We give it a name and then select it to see its properties in the inspector.

Fig. 4: We select the material to see its parameters in the inspector.

In the header of the inspector, we locate the field “Shader” which by default is set to “Standard” and change it to the type Shader “Skybox > Cubemap”, as shown in figures 5 and 6.

Fig. 5: We click on the Shader tab to change the Shader type.
Fig. 6: Select the Cubemap Shader within the Skybox section.

Now the inspector for this material will be shown with other parameters than before, as we see in figure 7.

Fig. 7: This is what the new material inspector looks like.

In principle we are interested in assigning our HDR texture to the “Cubemap HDR” field but first we have to make some adjustments to the image. We select the HDR texture that we have imported.

Fig. 8: We select the HDR texture that we previously imported to see its parameters in the inspector.

We changed the “Texture Shape” field to Cube and applied the changes

Fig. 9: We changed the texture type to Cube in order to use it in the Skybox Cubemap.
Fig. 10: Apply the changes when the configuration is finished.

This will allow us to use the texture for the Skybox material, we can either drag the texture directly into the field or press the “Select” button and select it from the popup window.

Fig. 11: Now we can drag the texture into the Cubemap space in the material inspector.
Fig. 12: You can also click on the select button and select it from the pop-up window

If everything goes well, you should see a result like the one in figure 13.

Fig. 13: With this you have the Skybox ready to use.

Now that we have the Skybox material set up, let’s apply it to the scene. For that we have to open the “Lighting” tab, in figure 14 you can see where that window is if you don’t have it open.

Fig. 14: We open the Lighting window to change the Skybox.

Inside the Lighting window we go to the “Environment” section and in the first field called “Skybox Material” we assign the Skybox material that we have previously configured.

Fig. 15: Inside the Lighting tab we go to the Environment section and select the Skybox.
Fig. 16: We select the HDR Cubemap texture that we previously configured.

In figure 17 you can see the first result of doing this, the texture does not look good at all due to the type of compression.

Fig. 17: First result, the Skybox is applied but the image has a certain quality loss.

We can select it and in the inspector change the compression to “RGB 16”, “RGB 24” or “RGBA 32”, this will bring an increase in the quality but also in the weight of the image. You can try downloading different qualities of HDR texture and try different formats to find a balance between quality and performance.

Fig. 18: We select the HDR texture and modify the format.

In figure 19 we see the final result that I have reached. Now that we have changed the new Skybox in the scene, we will be able to do lighting bakes to get better results.

Fig. 19: The quality has improved but so has the weight of the image.

Exit mobile version
Secured By miniOrange