支持的格式
Unity can read the following file formats:
- BMP
- EXR
- GIF
- HDR
- IFF
- JPG
- PICT
- PNG
- PSD
- TGA
- TIFF
HDR Textures
When importing from an EXR or HDR file containing HDR information, the Texture Importer automatically chooses the right HDR format for the output Texture. This format changes automatically depending on which platform you are building for.
- 当从包含HDR信息的EXR或HDR文件导入时,纹理导入器自动为输出纹理选择正确的HDR格式。这种格式会根据您为哪个平台构建而自动更改。
Texture dimension sizes
Ideally, Texture dimension sizes should be powers of two on each side (that is, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 pixels (px), and so on). The Textures do not have to be square; that is the width can be different from height. Note that specific platforms may impose maximum Texture dimension sizes. For DirectX, the maximum Texture sizes for different feature levels are as follows:
- 理想情况下,纹理尺寸应该是每边2的幂(即,2、4、8、16、32、64、128、256、512、1024、2048像素,等等)。纹理不必是方形的;也就是说宽度可以和高度不同。注意,特定的平台可能会有最大的纹理尺寸限制。对于DirectX,不同特征层的最大纹理大小如下:
Graphics APIs / Feature levels |
Maximum 2D and Cubemap texture dimension size (px) |
DX9 Shader Model 2 (PC GPUs before 2004) / OpenGL ES 2.0 |
2048 |
DX9 Shader Model 3 (PC GPUs before 2006) / Windows Phone DX11 9.3 level / OpenGL ES 3.0 |
4096 |
DX10 Shader Model 4 / GL3 (PC GPUs before 2007) / OpenGL ES 3.1 |
8192 |
DX11 Shader Model 5 / GL4 (PC GPUs since 2008) |
16384 |
Notes:
The Texture Importer only allows you to choose dimension sizes up to 8K (that is 8192 x 8192 px).
- Texture Importer只允许选择尺寸不超过8K的尺寸(即8192 x 8192 px)
Mali-Txxx GPUs (See Wikipedia) and OpenGL ES 3.1 (www.opengl.org) only support up to 4096px Texture dimension size for cubemaps.
- 对于cubemaps, Mali-Txxx gpu(参见Wikipedia)和OpenGL ES 3.1 (www.opengl.org)只支持高达4096px的纹理尺寸
It is possible to use NPOT (non-power of two) Texture sizes with Unity; however, NPOT Texture sizes generally take slightly more memory and might be slower for the GPU to sample, so it’s better for performance to use power of two sizes whenever you can. If the platform or GPU does not support NPOT Texture sizes, Unity scales and pads the Texture up to the next power of two size. This process uses more memory and makes loading slower (especially on older mobile devices). In general, you should only use NPOT sizes for GUI purposes.
You can scale up NPOT Texture Assets at import time using the Non Power of 2 option in the Advanced section of the Texture Importer.
- 简述:应该尽量用POT(2的次幂),NPOT会占用更大的内存,GPU读取速度也更慢。如果是在一些老旧的不支持NPOT的设备上,Unity还会把它扩大到最接近的2的次幂上,这一行为会浪费更多内存。Unity的Non Power of 2选项可以在编辑器里提前完成修改为2的次幂的行为,但是测试来看不支持Sprite
UV mapping
When mapping a 2D Texture onto a 3D model, your 3D modelling application does a type of wrapping called UV mapping. Inside Unity, you can scale and move the Texture using Materials
. Scaling normal and detail maps is especially useful.
- 2D图片映射到3D模型上,这种图片称为UV mapping
Mip maps
Mip maps are lists of progressively smaller versions of an image, used to optimise performance on real-time 3D engines. Objects that are far away from the Camera use smaller Texture versions. Using mip maps uses 33% more memory, but not using them can result in a huge performance loss. You should always use mip maps for in-game Textures; the only exceptions are Textures that are made smaller (for example, GUI textures, Skybox
, Cursors and Cookies). Mip maps are also essential for avoiding many forms of Texture aliasing and shimmering.
- mipmaps是一个图像的不断缩小的版本列表,用于优化实时3D引擎的性能。远离相机的物体使用