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.
プロパティ: | 特徴: |
---|---|
Right (+X) | Cubemap の面の右側テクスチャ。 |
Left (-X) | Cubemap の面の上側のテクスチャ。 |
Top (+Y) | Cubemap の面の上側のテクスチャ。 |
Bottom (-Y) | Cubemap の面の下側のテクスチャ。 |
Front (+Z) | Cubemap の面の前方のテクスチャ。 |
Back (-Z) | 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? |
You can create a new cubemap asset from the editor by selecting
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.