Version: 2022.1
导入纹理
Default

Texture Import Settings

Texture Import Settings 窗口定义 Unity 如何将图像从项目的 Assets 文件夹导入 Unity Editor。

要访问此窗口,请在 Project 窗口中选择图像文件。此时会在 Inspector 中显示 Texture Import Settings 窗口。

注意:默认情况下会隐藏一些不太常用的属性。在 Inspector 窗口中展开 Advanced 部分即可查看这些属性。

Texture Import Settings 窗口
Texture Import Settings 窗口

Texture Import Settings 窗口上有多个部分:

(A) Texture Type。选择要创建的纹理类型。

(B) Texture Shape。在该区域中选择形状并设置特定于该形状的属性。

(C) Type-specific and advanced properties. Depending on what Texture Type value you select, extra properties might appear in this area.

(D) 特定于平台的覆盖。使用__特定于平台的覆盖 (Platform-specific overrides)__ 面板可设置默认选项以及针对特定平台覆盖这些选项。

(E) 纹理预览。在此处可以预览纹理以及调整其值。

Texture Type

使用 Texture Type 属性可选择要从源图像文件创建的纹理类型。Texture Import Settings 窗口中的其他属性将根据此处设置的值而变化。

The following table lists the available texture types and explains their purpose.

属性 功能
Default This is the most common setting used for all Textures. It provides access to most of the properties for Texture importing. For more information, see the Default Texture type.
Normal map The Normal map texture type formats the texture asset so it’s suitable for real-time normal mapping. For more information, see the Normal map texture type documentation.

For more information on normal mapping in general, see Importing Textures.
Editor GUI and Legacy GUI The Editor GUI and Legacy GUI texture type formats the texture asset so it’s suitable for HUD and GUI controls. For more information, see the Editor GUI and Legacy GUI texture type documentation.
Sprite (2D and UI) The Sprite (2D and UI) texture type formats the texture asset so it’s suitable to use in 2D applications as a Sprite. For more information, see the Sprite (2D and UI) texture type documentation.
Cursor The Cursor texture type formats the texture asset so it’s suitable to use as a custom mouse cursor. For more information, see the Cursor texture type documentation.
Cookie The Cookie texture type formats the texture asset so it’s suitable to use as a light cookie in the Built-in Render Pipeline. For more information, see the Cookie texture type documentation.
光照贴图 The Lightmap texture type formats the texture asset so it’s suitable to use as a Lightmap. This option enables encoding into a specific format (RGBM or dLDR depending on the platform) and a post-processing step on texture data (a push-pull dilation pass). For more information, see the Lightmap texture type documentation.
Directional Lightmap The Directional Lightmap texture type formats the texture asset so it’s suitable to use as a directional Lightmap. For more information, see the Directional Lightmap texture type documentation.
Shadowmask The Shadowmask texture type formats the texture asset so it’s suitable to use as a shadowmask. For more information, see the Shadowmask texture type documentation.
Single Channel The Single Channel texture type formats the texture asset so it only has one channel. For information on the properties available only for the this type, see the Single Channel texture type documentation.

Texture Shape

使用 Texture Shape 属性可选择和定义纹理的形状和结构。有四种形状类型:

  • 2D 是用于所有纹理的最常用设置;它将图像文件定义为 2D 纹理。这些设置用于将纹理映射到 3D 网格和 GUI 元素以及其他项目元素。
  • Cube defines the Texture as a cubemap. You could use this for Skyboxes or Reflection Probes, for example. This type is only available with the Default, Normal Map), and Single Channel Texture types.
  • 2D Array 将纹理定义为 2D 数组纹理。这通常用作某些渲染技术的优化,其中会使用许多具有相同大小和格式的纹理。
  • 3D 将纹理定义为 3D 纹理。某些渲染技术使用 3D 纹理表示体积数据。

立方体贴图

可使用以下属性进一步优化 Cubemap 形状纹理:

属性: 功能:
Mapping 使用 Mapping 可指定如何将纹理投影到游戏对象上。默认情况下,此设置为 Auto
Auto Unity 尝试根据纹理信息创建布局。
6 Frames Layout (Cubic Environment) 纹理包含按以下标准立方体贴图布局之一排列的六个图像:交叉或序列 (+x -x +y -y +z -z)。图像可以水平或垂直定向。
Latitude Longitude (Cylindrical) 将纹理映射到 2D 纬度/经度表示形式。
Mirrored Ball (Sphere Mapped) 将纹理映射到类似球体的立方体贴图。
Convolution Type Choose the type of pre-convolution (filtering) that you want to use for this Texture. The result of pre-convolution is stored in mips.
This property is only available for the Default Texture type.
None 纹理没有预卷积(无过滤)。此为默认值。
Specular (Glossy Reflection) 选择此选项可将立方体贴图用作反射探针。纹理 Mipmap 使用引擎 BRDF 进行预卷积(过滤)。有关更多信息,请参阅 Wikipedia 的双向反射分布函数 (Bidirectional reflectance distribution function) 页面。
Diffuse (Irradiance) 对纹理进行卷积(过滤)以表示辐照度。如果将立方体贴图用作光照探针,则此选项非常有用。
Fixup Edge Seams 仅在选择 NoneDiffuse 卷积(过滤)的情况下,此选项才可用。在低端平台上使用此选项作为解决过滤限制(例如在面之间错误过滤的立方体贴图)的解决方法。

2D 数组以及 3D 列和行

2D 数组__和 3D__ 纹理的源纹理文件会划分为单元格;这些纹理称为翻页纹理。当 Unity 导入翻页纹理时,它会将每个单元格的内容放入其自己的 2D 数组层或 3D 纹理切片中。

Texture Shape 属性设置为 2D Array3D 时,Unity 会显示 ColumnsRows 属性。使用这些属性可告诉 Unity 如何将翻页纹理划分为单元格。

属性: 功能:
Columns 源翻页纹理划分为的列数。
源翻页纹理划分为的行数。

例如,具有 8x8 单元格烟雾效果帧的图像如下所示(作为默认 2D 纹理):

作为 2D 形状的翻页图像
作为 2D 形状的翻页图像

但是当正确导入具有 8 列和 8 行的 3D 纹理时,它会如下所示:

作为 3D 形状的翻页图像
作为 3D 形状的翻页图像

Type-specific and advanced properties

Depending on which Texture Type you select, different properties can appear in the Texture Import Settings window. Some of these properties are specific to the Texture Type itself, such as Sprite Mode available with the Sprite (2D and UI) type.

Use Advanced settings to make finer adjustments to the way Unity handles the Texture. The order and availability of these settings can vary depending on the Texture Type you choose.

For information on the properties for each texture type, see the documentation for that texture type:

特定于平台的覆盖 (Platform-specific overrides)

When building for different platforms, you need to think about the resolution, the file size with associated memory size requirements, the quality of your Textures, and what compression format to use for each target platform. The Platform-specific overrides panel provides one tab for the Default options, and one tab for every target platform you are building for. Some texture import settings can also be overridden globally in Build Settings, mostly to speed up iteration time during development.

特定于平台的覆盖面板
特定于平台的覆盖面板

要设置覆盖值,请执行以下操作:

  1. 设置 Default 选项卡上的默认属性。
  2. 导航到特定的目标平台选项卡,并启用 Override for <target-platform> 选项。
  3. 设置覆盖属性。

下表描述了可用的属性:

属性: 功能:
Max Size 设置导入的纹理的最大尺寸(以像素为单位)。美术师通常喜欢使用尺寸较大的纹理,但您可以将纹理缩小到合适的尺寸大小。
Resize Algorithm 当纹理尺寸大于指定的 Max Size 时,选择一种算法来缩小纹理尺寸。
Mitchell 使用 Mitchell 算法调整纹理的大小。这是默认的大小调整算法。
Bilinear 使用双线性插值来调整纹理的大小。如果小而锐利的细节在图像中很重要,此设置可以保留比 Mitchell 更多这些细节。
Format 绕过自动系统来指定用于纹理的内部表示。可用格式的列表取决于平台和纹理类型。有关更多信息,请参阅特定于平台的覆盖的纹理格式

注意:即使不覆盖平台,此选项也会显示自动系统选择的格式。此属性仅在覆盖特定平台时可用,而不是作为默认设置。
Compression 选择纹理的压缩类型。这有助于 Unity 为纹理选择正确的压缩格式。根据平台和压缩格式的可用性,不同的设置可能最终会获得相同的内部格式。例如,__Low Quality Compression__ 会影响移动平台,但不会影响桌面平台。
None 不压缩纹理。
Low Quality 以低质量格式压缩纹理。这种质量比 Normal Quality 使用更少的内存。
Normal Quality 以标准格式压缩纹理。
High Quality 以高质量格式压缩纹理。这种质量比 Normal Quality 使用更多的内存。
Use Crunch Compression 如果适用,使用 Crunch 压缩。Crunch 是一种基于 DXT 或 ETC 纹理压缩的有损压缩格式。Unity 在 CPU 上将纹理解压缩为 DXT 或 ETC,然后在运行时将其上传到 GPU。Crunch 压缩有助于纹理在磁盘上使用尽可能少的空间并方便下载。Crunch 纹理可能需要很长时间进行压缩,但在运行时的解压缩速度非常快。
Compressor Quality 使用 Crunch 纹理压缩时,可使用滑动条调整质量。压缩质量越高意味着纹理越大,压缩时间越长。

注意:对于 Android 平台,Compressor Quality 值提供的选项略有不同。有关更多信息,请参阅特定于平台的覆盖的纹理格式
Split Alpha Channel 允许在以下平台上对此纹理进行 Alpha 通道分离:__tvOSiOSLumin__ 和 Android。有关更多信息,请参阅关于 Android 的注意事项:纹理压缩格式
Override ETC2 fallback ETC2 texture decompression fallback override on Android devices that don’t support ETC2.

Allows to choose which texture format to decompress the texture to on Android devices that have no ETC2 texture format support. For more information, see the Notes on Android for Texture compression formats.



  • 2017.3 版中更新了 Crunch 压缩格式 NewIn20173
  • 2020.1 中添加了“Ignore PNG file gamma”NewIn20201
导入纹理
Default
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961