Using skyboxes in Unity3d

  • Tutorial
I offer readers of "Habrahabr" a translation of the publication "Unity - Using Skyboxes" from the blog of Unity.

Additional materials for the Skybox and Cubemap article

Skybox is a panoramic texture that is behind all the objects in the scene to simulate the sky or a big city or any other perspective at a great distance (a kind of background). This tutorial explains how to use skybox in Unity .

What are Skyboxes?

Skybox - a panoramic view divided into six textures, representing six visible directions along the main axes (up, down, left, right, forward and backward) (up, down, left, right, forward and backward) . If the Skybox is created correctly, the texture images will be as a unit along the edges to give a continuous surrounding image that can be viewed “from the inside” in any direction. The panorama is behind all other objects in the scene and rotates in accordance with the current orientation of the camera (do not confuse it with the position of the camera, which is always taken to be in the center of the panorama). Skybox in this way is an easy way to add realism to the scene with minimal load on the graphics card.

Using Skybox in Unity

Unity comes with a number of high-quality Skyboxs in the Standard Assets package (menu: Assets> Import Package> Skyboxes ), but you can also pick up suitable sets of panoramic images from online sources or create your own using 3D modeling software. Assuming you already have six image textures for Skybox , you should import them into Unity . After we go to our skybox , then go to the Inspector panel . And set its properties, set the Wrap Mode property to Clamp (if you set the value to Repeat, the edges of the images will not form a “seamless” texture).


Sam Skybox is actually a type of material that uses one of the shaders in the sub- RenderFX . If you select Skybox Shader , you will see in the inspector panel something like the following, with six texture examples: The


Skybox Cubed shader works basically the same, but requires textures that will be added to the cubemap asset (menu: Assets> Create > Cubemap ). Cubemap has six texture slots with the same values ​​as Skybox in the material inspector panel .

After it is created, you can set the new Skybox as the default Skybox (for the whole project) in the visualization settings inspector (menu: Edit> Render Settings ). You can override the default Skybox for each camera by assigning a new Skybox in the Camera > Skybox component (visible in the camera inspector).

Also popular now: