This page has been translated automatically.
UNIGINE 基础课程
1. 简介
2. 虚拟世界管理
3. 3D模型准备
5. 摄像机和光照系统
6. 实现应用程序逻辑
7. 制作过场动画与动画序列
8. 准备发布项目
9. 物理系统
10. 优化基础
11. 项目2:第一人称射击游戏
12. PROJECT3: Third-Person Cross-Country Arcade Racing Game
13. PROJECT4: VR Application With Simple Interaction

材质中的纹理

A texture (or map) is a raster image that defines the material color (or any other feature, such as relief) at each point on a surface. We can say that a texture is superimposed on a surface — a special map is created that maps the points of a three-dimensional surface to a flat image. This map determines how exactly the texture is overlaid onto your model and matches polygons with the texture islands. This map is called UV map and it is usually stored in the model itself, and the process of its creation is called UV unwrapping.纹理(或称贴图)是一种栅格图像,用于定义表面每个点的材质颜色(或其他特征,如凹凸)。我们可以说纹理是叠加在表面上的,通过创建一种特殊映射,将三维表面上的点对应到二维图像上。这种映射称为UV贴图,通常存储在模型内部,其创建过程称为UV展开。

In early visualizations, the polygons of the model were just "filled" with color, now 3D modeling operates with a great variety of textures. They can be projected directly onto the surface (albedo), can be used as masks (for example, to define transparent areas), besides, pixel values of textures can be used for other calculations (for example, 3D textures may be used to define the cloud shape). Textures can also be used to simulate the environment (cube maps that are projected onto the walls of a cube from the inside) or as filters on light sources like a spotlight. Here is just a small list of the most commonly used textures:在早期可视化中,模型的多边形只是用颜色"填充",而现代3D建模则运用多种多样的纹理。它们可以直接投射到表面(如反照率贴图),可用作遮罩(例如定义透明区域),纹理的像素值还可用于其他计算(例如3D纹理可定义云朵形状)。纹理也能用于模拟环境(立方体贴图从内部投射到立方体墙面)或作为聚光灯等光源的滤镜。以下是常用纹理的小部分示例:

  • Albedo map is a color map or model coloring. For a long time this was the only map applicable to the model (besides UV), and many games (especially mobile games, where saving memory space and computational resources is extremely important) still use only this map. Although, skillful use of diffuse map can replace other maps to some extent, it many cases is not enough.反照率贴图(Albedo map)是颜色贴图或模型着色图。很长时间里这是模型唯一可用的贴图(除UV外),许多游戏(尤其是对内存和计算资源极为敏感的移动游戏)至今仍仅使用此贴图。虽然巧妙运用漫反射贴图能在某种程度上替代其他贴图,但多数情况下仍显不足。

  • Emission map has a name that explains its function: black means no light emission, pure white means maximum emission, and all available shades of color channels allow you to paint the object in all possible colors, like a neon sign.自发光贴图(Emission map)其名即功能:黑色表示无发光,纯白表示最大发光度,所有可用色彩通道的色调让物体能像霓虹灯般呈现各种发光颜色。

  • Ambient Occlusion (AO) map is used to store the information about indirect lighting intensity, the amount of light reaching the surface — some areas are brighter, some are darker. This map can highlight the relief shown on the main texture, without it the material may look more flat.环境光遮蔽贴图(AO,ambient occlusion)存储间接光照强度信息,表示到达表面的光量:某些区域更亮,某些更暗。此贴图能突出主纹理显示的凹凸细节,缺失会使材质显得平坦。

  • Normal map is a map that imitates volume without increasing the number of polygons. It creates the illusion of an uneven surface due to light and shadow transitions. Normals are stored not just for polygon vertices or planes, but for each pixel of the superimposed texture map. Normal maps change the direction of light reflected from an object, making it look more complex than it really is (like holograms — they are absolutely flat, but reflect light as a three-dimensional object would).法线贴图(Normal map)在不增加多边形数量的情况下模拟体积感。通过光影过渡制造表面不平的错觉。法线信息不仅存储于多边形顶点或平面,还存在于纹理贴图的每个像素。法线贴图改变物体反射光的方向,使其看起来比实际更复杂(如同全息图:绝对平面却能像三维物体般反射光线)。

  • Displacement map is a single-channel map that stores the distortion (displacement) values of the model surface. Unlike the normal map, it does not simulate volume, but directly informs the engine how the model should look like (that's why the model has real volume in the final image, not its illusion).置换贴图(Displacement map)是单通道贴图,存储模型表面的形变(位移)值。与法线贴图不同,它不模拟体积而是直接告知引擎模型的真实形态(因此最终图像中模型具有真实体积而非幻觉)。

  • Transparent map, alpha map or simply alpha is a map responsible for marking transparent areas on the texture. This function is often (and UNIGINE is no exception) is taken over by an albedo map, which has an additional alpha channel. It can be either really transparent (PNG files) or just carry information about transparency (DDS and TGA formats).透明贴图(Transparent map)、阿尔法贴图(alpha map)或简称阿尔法(alpha),是标记纹理透明区域的贴图。该功能常由反照率贴图承担(UNIGINE也不例外),反照率贴图包含额外阿尔法通道。可以是真实透明(PNG文件)或仅携带透明度信息(DDSTGA格式)。

Procedurally Generated Textures
程序化生成纹理#

You can apply not only ready-made textures to an object, but also textures generated by a computer. For instance, you can create a noise texture, which is an image that contains visual noise.你不仅可以给物体应用现成的纹理,还能使用计算机生成的纹理。例如,可以创建噪点纹理(noise texture),一种包含视觉噪点的图像。

This type of texture can be helpful in making the surface of a model look less perfect, as real-life objects are almost never perfectly smooth or uniformly colored. They usually have some scuffs, stains, scratches, and other minor defects. By using noise as a displacement map, you can easily create realistic textures like plaster, orange zest, the surface of Mars, and more.这类纹理有助于让模型表面看起来不那么完美,因为现实中的物体几乎从不是完全光滑或颜色均匀的。它们通常会有磨损、污渍、划痕和其他微小瑕疵。通过将噪点用作置换贴图,你可以轻松创建逼真的纹理效果,如石膏墙面、橙子表皮、火星表面等。

A material can utilize several textures for various purposes. For instance, it can incorporate an albedo texture, an ambient occlusion texture, and a normal map. Furthermore, alpha channels of one or more of these textures may store roughness and emission maps.一个材质可以结合多种纹理实现不同效果。例如,它可以同时包含反照率纹理、环境光遮蔽纹理和法线贴图。此外,这些纹理中的一个或多个alpha通道可能存储粗糙度和自发光贴图数据。

The process of creating textures is called texturing, and it is typically performed using specialized software. Ready-made textures can also be purchased or downloaded for free from various online resources. UNIGINE allows for the import and use of ready-made textures, as well as the creation and editing of textures and masks directly on objects using the built-in Texture Editor (we will review this tool in more detail later).纹理创作的过程称为纹理绘制,通常使用专业软件完成。现成的纹理也可以从各种网络资源购买或免费下载。UNIGINE既支持导入使用现成纹理,也允许通过内置的纹理编辑器直接在物体上创建和编辑纹理与遮罩(我们将在后续详细讲解该工具)。

You can also assign a texture to the corresponding material slot via the Parameters window simply by dragging an asset into the corresponding field.你还可以通过参数窗口为材质槽位分配纹理,只需将资源拖拽到对应字段即可。

When importing textures, it is crucial to indicate their type as it determines the final format of the runtime-texture, channels to be used, and compression methods to be applied. To specify this, you can select the appropriate preset while importing a texture asset.导入纹理时,正确标明纹理类型至关重要,因为这决定了运行时纹理的最终格式、使用的通道以及应用的压缩方法。为此,你可以在导入纹理资源时选择合适的预设。

Moreover, you can add a postfix to the texture name to pre-define its type and apply the necessary import parameters automatically. Postfixes correspond to presets such as _alb for Albedo, _n for Normal, _e for Emission, and more (see documentation for a complete list).此外,你可以通过在纹理名称中添加后缀来预定义其类型,系统会自动应用对应的导入参数。常用后缀包括:_alb表示反照率,_n表示法线贴图,_e表示自发光等(完整列表请参阅文档)。

It is crucial to ensure that the texture resolution on each axis is divisible by a power of 2 (POT — Power-Of-Two textures) for optimal memory usage, efficient compression, and performance enhancement — this recommendation is applicable to any engine. Texture size also impacts performance and memory utilization, so it is essential to avoid using a 4K texture where a 512x512 texture size is sufficient. The built-in Texture Profiler in UNIGINE can help track potential problems with textures in your project. Further recommendations on texture optimization will be provided in the corresponding section.为确保最佳内存使用率、高效压缩和性能提升,纹理各轴分辨率必须是2的幂次方(POT,Power-Of-Two 纹理),这一建议适用于所有引擎。纹理尺寸同样影响性能和内存占用,因此应避免在512x512分辨率足够时使用4K纹理。UNIGINE内置的纹理分析器(Texture Profiler)可帮助检测项目中潜在的纹理问题。更多纹理优化建议将在对应章节提供。

本页面上的信息适用于 UNIGINE 2.20 SDK.

最新更新: 2025-06-09
Build: ()