We’ve used detail maps for macro-detailing (see the tutorial on “Trainz Dev Diary – Detail Map Ground Textures”) but in this tutorial we use it for micro-detailing to add, in this case, some extra roughness to the surface using the material m.pbrmetaldetail.
You can read all about how the m.pbrmetaldetail material works on the Trainz wiki, but in a nutshell it is defined by:
1. The Alpha channel of the Albedo texture defines whether the detail map is used at this location on the material. 0.0 (black) indicates that the detail map is not used, giving a result identical to m.pbrmetal. 1.0 (white) indicates that the detail map is used at full strength. Values between these extremes offer a partial-strength detail map.
2. The Detail Albedo texture is an RGB: Albedo modifier. This is combined into the fragment’s primary albedo on a per-channel basis. At 0.0, and at full detail map strength, the channel is reduced to 0%. At 1.0, the channel is increased to 200%. At 0.5, the channel is left at 100%. The result is clamped into the 0.0 .. 1.0 range. A: Unused. Should be omitted.
This texture example has been set to 0.5 (128,128,128) so the overall albedo colour will not change.
3. The Detail Normal texture is an RGB: Surface normal. This functions in an identical manner to the primary normal map, and is simply an additional offset to the normal. A: Unused. Should be omitted.
In the above traincar example video we tile the detail by 80 times across the sections of the mesh that have this m.pbrmetaldetail applied to it. The comparison of no detail vs. detail can be seen in the video above.