Textures in Materials
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.
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:
-
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.
-
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.
-
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.
-
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).
-
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).
-
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).
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.
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.
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).
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).
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.