The Dirt Layer function is deprecated in favor of the superior Blend Shader. It will be removed in future revisions of CRYENGINE.
Note that the Blend Shader has the ability to use both Vertex Alpha and/or a dedicated Blend mask texture which allows for much more refined blending.

Overview

The dirt layer allows you to blend another texture onto your base material in the same draw call without the need to place an extra decal. The blended texture itself supports an alpha channel, and the amount of blending is controlled through the vertex alpha in your mesh and a shader attribute. Additionally, you can specify the tiling and the alpha for your dirt texture. Since the dirt texture uses the same UVs as the base diffuse texture, you can counteract unwanted tiling with the tiling parameter.

For more information please refer to the Illum Shader for more information.

Setup in 3ds Max

Applying the Dirt to the Object

To set up the asset, apply a VertexPaint modifier to your mesh and set its channel to Vertex Alpha. You can now paint the areas that are supposed to be affected by dirt. Black will set the opacity of your dirt layer to 100% and make the dirt fully visible, white will not show any dirt at all. Shades of gray will blend between both dirt and the base diffuse texture. You can also select a bunch of vertices and give them a typed-in vertex alpha value. The Alpha Value can be set under the Vertex Properties tab when in Vertex Selection Mode.

To only see the vertex alpha in the viewport, right click on your object, check Vertex Channel Display, and set it to VertexAlpha.

Usage in CryENGINE

The dirt layer currently only works with the Illum shader. First load up your Dirt Texture in the Custom Slot of the shader. Then check Dirtlayer under Shader Generation Params to enable the Dirt layer parameters.

You must manually set up each Dirt layer to match the parameters you used in the Max DirectX Dirt layer:

Using the Dirt Layer

The idea behind the dirt layer is to add detail to objects without having a heavy impact on performance. Since you are limited to small tiling textures and a few materials, the dirt layer allows you to add visual variety in objects while not adding too many new textures.

By using the vertex alpha you ensure that you can still use vertex colors to add additional shading information to our meshes.

Every dirt texture should be tillable and reusable on other assets. Your goal should be to create a library of textures to dirty up all of the base materials.

Chipped Paint

Here is a 256x256 tileable concrete texture as a base. The Dirt texture itself is a white concrete material with a mask in the alpha channel to create the "chipped paint" effect. The resolution of the Dirt texture is 512x512 in order to keep the mask crisp.

By using white as a base color, you can easily tint the Dirt texture through the tint attribute in the shader. By adding edges and modifying the vertex alpha, you can specify where you want your texture to be blended in.

Walls and Other Objects

Here you can see how you can use the same dirtmask to dirty up different kind of materials.

Adding Variation to Essential Objects

In some cases, it can be beneficial to create a dirt texture that is unique and not tiling.

For example, in the following examples there are a lot of metal planks that are used as roofing for buildings. This means that these objects are often visible and need to be visually interesting. In order to achieve that, you should define the shapes that you want for the metal planks.

In order to make the most of the textures, make sure that they use the available UV Space to the fullest extent. After creating the mask, specify which planks will be colored (and in what way) and build the objects with the predefined pieces.

Making the Most of the Dirt Layer

Use a tiling base texture to start with. Create an interesting dirt texture in order to add variance to the base texture. Use vertex colors to add subtle color variation and basic ambient occlusion. Make sure to use all of these three elements whenever possible.

Reusing the Dirt Textures

If you have a good base texture with a strong normalmap, it is worth trying to reuse existing dirt textures/masks on your material before creating a new one.

Often you can achieve the desired effect with already existing textures and the tinting functionality in the shader. This saves texture memory and time.

 

污浊层

概述

通过污浊层可将另一纹理混合到相同的绘制调用的基本材质内,且不需放置额外贴花。已混合的纹理本身支持阿尔法通道,混合数量由网格体和 shader 属性的顶点阿尔法控制。此外,可指定污浊纹理的重复拼贴和阿尔法。因为污浊纹理使用相同的 UV 作为基本漫反射纹理,所以您可以用重复拼贴参数抵消不想要的重复拼贴。

更多信息请参考照明 Shader

XSI 中的设置

XSI 工作流

  1. 对象的模块和纹理正常都是标准材质和漫反射纹理
  2. 选择对象,在顶点贴图的“渲染”工具栏内选择“获取 – 属性 – 颜色”
  3. 然后转到“摄像机显示属性编辑器”将“顶点颜色属性显示”设置为“显示 Alpha”
  4. 按 Ctrl+W 打开“Brush 属性”属性编辑器将“颜色绘制模式”设置为 Alpha
  5. 若要设置 Alpha 值,必须使用调色板控制的 RGBA 滑杆内的“一个”滑杆。
  6. 在对象透明顶点处将可见污浊层。
  7. 将对象导出至 CryENGINE
  8. 在 CryENGINE 内设置污浊层材质

3ds Max 中的设置

对象应用污浊

若要设置资源,对网格体应用“顶点绘制”修改器并将其通道设置为“顶点 Alpha”。此时绘制受污浊影响的区域。黑色将污浊层的不透明度设置为 100% 并使污浊完全可见,白色不显示任何污浊。灰色阴影将混合污浊和基本漫反射纹理。也可以选择许多顶点并指定已输入的顶点 alpha 值。在“顶点选择”模式的“顶点属性”选项卡下设置“Alpha 值”。

若仅想查看视口内的顶点 alpha,右击对象,选中“顶点通道显示”并将其设置为“顶点 Alpha”。

CryENGINE 中的用法

污浊层当前仅与照明 shader 一起使用。首先在 shader 自定义槽内加载污浊层。再选中“Shader 生成参数”下的“污浊纹理”启用污浊层参数。必须手动设置每个污浊层与 Max DirectX 污浊层中使用的参数匹配:

使用污浊层

污浊层背后的意图是将对象添加细节,且对性能无太大影响。因为仅限小的重复拼贴纹理和少部分材质,所以通过污浊层可在对象中添加多个可见纹理而不是添加过多的新纹理。使用顶点 alpha 时确保使用顶点颜色在网格体内添加附加的渲染信息。

每个污浊纹理应可拼贴及对其他资源的可重复使用性。目标应该是创建纹理库为所有基本材质处理污浊效果。

裁剪绘制

下面是一个以 256x256 为基础的可拼贴的混凝土纹理。污浊纹理本身就是一种阿尔法通道内带有可创建“裁剪绘制”特效掩码的混凝土材质。分辨率为 512x512 的污浊纹理可保持掩码的清晰度。
将白色作为基准色,可以轻松地在 shader 内通过着色属性对污浊纹理着色。通过添加边缘和修改顶点 alpha,可指定混合纹理的位置。

墙壁和其他对象

在此将看到如何使用相同 dirtmask 污浊不同种类材质。

为基本对象添加差异效果

在某些情况下,创建一个唯一的不可重复拼贴的污浊纹理很有益处。

例如,在以下示例中有许多用于建造建筑物屋顶的金属板。这意味着这些对象经常可见且需要很好的可视效果。为了做到这一点,应为金属板定义形状。为了充分利用纹理,确保使用的有效 UV 空间得到最大程度的利用。创建掩码后,指定需着色的金属板(以何种方式)并使用预定义的片段建立对象。

充分利用污浊层

从使用重复拼贴的基础纹理开始。创建一个有趣味的污浊纹理以便对基础纹理添加变化效果。使用顶点颜色添加微妙的颜色变化和基本环境光遮蔽。确保尽可能使用这三种元素。

重复利用污浊纹理

如果拥有一个具有稳固法线图的良好的基础纹理,则在新建纹理之前有必要尝试重复利用材质内现有的污浊纹理/掩码。通常可以实现与 shader 中现有纹理和着色功能相同的所需效果。这样可以节省纹理内存和时间。