I offer the readers of Habrakhabr a translation of the Unity - Using Skyboxes publication from the Unity company blog.Additional materials for the article Skybox and CubemapSkybox 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 lesson explains how to use
skybox in
Unity .
')
What is 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 (not to be confused with the position of the camera, which is always taken to be in the center of the panorama).
Skybox is thus a simple way to add realism to the scene with a minimum load on the video card.
Using Skybox in Unity
Unity comes with a number of high-quality
Skybox in the
Standard Assets package (menu:
Assets> Import Package> Skyboxes ), but you can also find suitable sets of panoramic images from online sources or create your own using 3D modeling software. Assuming you already have six image textures for the
Skybox , you must import them into
Unity . Then go to our
skybox , then go to the
Inspector panel. And set its properties, set the
Wrap Mode property to the value of the
Clamp (if you set the
Repeat value, the edges of the images will not form a “seamless” texture).
Skybox itself is actually the type of material that one of the shaders uses in the
RenderFX submenu. If you select the
Skybox Shader , you will see in
the inspector panel something like the following, with six examples of textures:
The Skybox Cubed shader works basically the same, but requires textures to be added to the
cubemap asset (menu:
Assets> Create> Cubemap ).
Cubemap has six texture slots with the same values ​​as the
Skybox in the
material inspector panel.
After it is created, you can set the new
Skybox as the default
Skybox (for the entire 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).