Legacy Documentation: Version 4.6.2
Language: English
Rendering Components
Occlusion Area (Pro Only)

Cubemap

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Scripting

A Cubemap is a collection of six separate square Textures that represent the reflections on an object from its environment. The six squares form the faces of an imaginary cube that surrounds the object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back). Assuming the squares match seamlessly at the edges, Unity’s Reflective built-in shaders can use a cubemap to display the surrounding view as it is reflected by the object.

A sphere using a cubemap to reflect the surrounding scene
A sphere using a cubemap to reflect the surrounding scene

Properties

Property: Function:
Right (+X) Texture for the right face of the Cubemap.
Left (-X) Texture for the left face of the Cubemap.
Top (+Y) Texture for the top face of the Cubemap.
Bottom (-Y) Texture for the bottom face of the Cubemap.
Front (+Z) Texture for the forward face of the Cubemap.
Back (-Z) Texture for the rear face of the Cubemap.
Face Size Width and Height of each Cubemap face in pixels. The textures will be scaled automatically to fit this size.
Mipmap Should mipmaps be created?
Linear Should the cubemap use linear color?
Format Should the cubemap allow scripts to access the pixel data?

Description

You can create a new cubemap asset from the editor by selecting Assets > Create > Cubemap from the menu. If you have six suitable images available then you can assemble the cubemap manually simply by dragging the textures to the empty slots in the inspector.

You can also use the Generate Cubemap option on the Texture Importer to produce a cubemap automatically from a single image. The importer will wrap the image around and join the edges but you will need to start with an image designed for this purpose to get the best results.

Another useful technique is to generate the cubemap from the contents of a Unity scene using a script. The Camera.RenderToCubemap function can record the six face images from any desired position in the scene; the code example on the function’s script reference page adds a menu command to make this task easy.

Rendering Components
Occlusion Area (Pro Only)