着色器: rendinst_mask_layered

概述

rendinst_mask_layered着色器设计用于使用两个细节平铺、一个全局法线贴图和一个覆盖纹理(使用modulate2x应用)来渲染实例。这些细节根据它们各自的高度贴图和叠加纹理中提供的混合蒙版进行混合。

此着色器与 rendinst_layeredrendinst_mask_layered 仅使用单个 UV 通道。

参数:

  • script:t="detail_tile=7.1" – 同时控制两个细节贴图的平铺。适用于两个详细信息。

  • script:t="invert_height1=1" – (default – ‘0’) – 反转 Detail1 的高度贴图。这可以是一个小数值(例如,’0.5’ 使高度贴图变为灰色)。

  • script:t="invert_height2=1" – (默认值为 ‘0’) – 反转 Detail2 贴图的高度贴图。这也可以是小数值。

  • script:t="paint_details=0,0,0,0" – 配置两个详细信息的着色。

  • script:t="paint_points=0,1,0,1" – 设置两个细节的着色范围的黑点和白点。

  • script:t="atest=1" – 启用 Alpha 测试。

  • script:t="details_alphatest=0,0.15,0.45,0" – 指定要应用 Alpha 测试的细节以及强度。

  • microdetails – 此着色器支持rendinst_simplerendinst_perlin_layered着色器。

  • heightmap blending– 有关高度贴图混合的更多信息,请参阅 与地形高度贴图混合.

材质结构

  • Slot 1: Overlay Texture 使用 modulate2x将覆盖纹理应用于其他纹理。

    • RGB Channels: Albedo

    • Alpha Channel: 细节的混合蒙版,类似于 rendinst_layered.

      • White pixel: Detail2 (upper)

      • Black pixel: Detail1 (lower)

      • Gray pixel: 显示该位置具有较高高度贴图值的细节。

如果创建的叠加没有混合蒙版,则默认为 100% 黑色。 因此,所有进一步的材质调整几乎不可见,因为仅显示 Detail1(蒙版中的黑色显示 Detail1)。


- **Slot 2: 未使用**

- **Slot 3: Global Normal Texture**
此纹理放置在细节法线下方,对其进行修改。
- **RG Channels:** Normal map
- **B Channel:** 未使用,应保持黑色。
- **Alpha Channel:** Smoothness(平滑度),使用 'modulate2x' 应用于细节的平滑度。

```{important}
避免向全局法线添加不必要的平滑度,除非:
1. 您正在强调叠加层中的特定元素,例如添加脏泄漏并在法线的 Alpha 上配置它们的平滑度。
2. 您需要在相同的细节中区分材质,例如在保持保险杠光泽的同时使车漆哑光。
3. 纹理不是唯一使用的,例如,当叠加层和全局法线的一部分与前灯或玻璃等元素的 [rendinst_simple](./rendinst_simple.md) 着色器共享时。

一个常见问题是向全局法线添加平滑度,这可能会覆盖细节的平滑度,只留下最突出的细节可见。
全局平滑度的未使用区域应保持 50% 灰色。
  • Slots 4-5: Detail1 Textures

    • Slot 4: Diffuse texture for Detail1.

    • Slot 5: Normal texture for Detail1.

  • Slots 6-7: Detail2 Textures

    • Slot 6: Diffuse texture for Detail2.

    • Slot 7: Normal texture for Detail2.

参数

  • script:t="detail_tile=7.1" – 同时控制两个细节贴图的平铺。

  • script:t="invert_height1=1" – (default – 0) – 反转 Detail1 的高度图。

  • script:t="invert_height2=1" – (default – 0) – 反转 Detail2 的高度贴图。

    Important

    rendinst_perlin_layered 着色器中,rendinst_mask_layered中的高度贴图反转参数不会影响细节的整体分布。相反,使用混合蒙版(叠加 Alpha)将细节分布在模型中。高度贴图反转会突出显示这些细节中的特定特征。

    如果高度贴图未反转,则白色(高)像素优先。例如,可以看到碎裂灰泥的完整部分(因为它们更高)。如果高度贴图是倒置的,则损坏的部分将变得突出(因为它们在倒置后会更高)。

  • script:t="paint_details=0,0,0,0" – 配置两个细节的着色(叠加层不着色)。

    • 第一个组件:Colors Detail1(非整数值可以指定强度)。

    • 第二个组件:Colors Detail2(非整数值可以指定强度)。

    • 第三个组件:未使用,但必须包含该组件才能使着色器正常运行。

    • 第四个组件:选择要着色的行。

  • script:t="paint_points=0,1,0,1" – 设置两个细节贴图的着色范围的黑点和白点。

  • 第一个组件:Detail1 的黑点,类似于rendinst_simple_painted

  • 第二个组件:Detail1 的白点。

  • 第三个组件:Detail2 的黑点。

  • 第四个组件:Detail2 的白点。

Important

始终为黑点和白点指定不同的值,即使细节没有着色。默认配置应为

script:t="paint_points=0,1,0,1".

否则可能会导致相同的黑点和白点,从而导致除零错误:

`rendinst_mask_layered: 除以零 [real] 时执行着色器 ode。在作数 #45’ 处停止。

这允许您为具有不同亮度变化的材质(如涂漆的木材)定义颜色范围。您可以调整黑点和白点以控制油漆层中的颜色变化,同时保持下面的木材层保持不变或变化最小。

  • script:t="atest=1" + script:t="details_alphatest=0,0.15,0.45,0":

    atestdetails_alphatest 必须一起使用参数才能启用和配置 alpha 测试:

    • script:t="atest=1" – 启用 Alpha 测试。

    • script:t="details_alphatest=0,0.15,0.45,0" – 指定要应用 Alpha 测试的细节以及强度。

  • Microdetails 功能与 rendinst_perlin_layered 着色器。

    See also

    有关更多信息,请参阅 微细节.