TerrainMaterialBlend
Description
- Derived from
A set of coefficients that control how material albedo and vertex colors are combined.
The material blend coefficients can be used to modify the material albedo color and the terrain vertex color and to control how these colors are combined:
-
The terrain material albedo (see TerrainMaterialTexture.AlbedoReflectivity) is blend with its grayscale variant, according to MaterialAlbedoGrayscale.
-
The terrain vertex color (see Semantic.Texture and HeightmapSample.Texture) is blend with its maximum brightness variant, according to VertexColorBrightness.
-
The modified material albedo, the modified vertex color and their modulation are blend together, according to BlendMaterial and BlendVertex.
The following formula is used to compute the final color:
materialAlbedo = Albedo of terrain material (linear sRGB) vertexColor = Vertex color of terrain mesh (linear sRGB) grayscale = Material albedo, converted to grayscale: materialAlbedo.r * 0.2126 + materialAlbedo.g * 0.7152 + materialAlbedo.b * 0.0722 maxBrightness = Vertex color, converted to maximum brightness: vertexColor / max(vertexColor.r, vertexColor.g, vertexColor.a) A = The material albedo to use for blending: (1 - MaterialAlbedoGrayscale) * materialAlbedo + MaterialAlbedoGrayscale * grayscale B = The vertex color to use for blending: (1 - VertexColorBrightness) * vertexColor + VertexColorBrightness * maxBrightness AB = Modulation of material albedo and vertex color: A * B finalColor = (1 - BlendMaterial - BlendVertex) * AB + BlendMaterial * A + BlendVertex * B
The factors MaterialAlbedoGrayscale and VertexColorBrightness should be in the range [0..1]. The blend factors BlendMaterial and BlendVertex should sum to 1
. However, it might be desirable to use factors outside of these ranges, for artistic effects.