TerrainMaterialBlend

Description

struct Tinman.Engine.Components.TerrainMaterialBlend

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 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.

Public / Constants

Material​Modulate


public static readonly attribute MaterialModulate → (TerrainMaterialBlend)

Modulates material albedo with maximum-brightness vertex color.

Material​Only


public static readonly attribute MaterialOnly → (TerrainMaterialBlend)

Material albedo only.

Vertex​Modulate


public static readonly attribute VertexModulate → (TerrainMaterialBlend)

Modulates maximum-brightness vertex color with grayscale material albedo.

Vertex​Only


public static readonly attribute VertexOnly → (TerrainMaterialBlend)

Vertex color only.

Public / Constructors

Terrain​Material​Blend


public constructor TerrainMaterialBlend → (4)

blendMaterial in : float32

See BlendMaterial.

blendVertex in : float32

See BlendVertex.

materialAlbedoGrayscale in : float32

See MaterialAlbedoGrayscale.

vertexColorBrightness in : float32

See VertexColorBrightness.

Creates a new instance of TerrainMaterialBlend.

Public / Attributes

Blend​Material


public readonly attribute BlendMaterial → (float32)

Blend factor for material albedo.

Blend​Vertex


public readonly attribute BlendVertex → (float32)

Blend factor for vertex color.

Material​Albedo​Grayscale


public readonly attribute MaterialAlbedoGrayscale → (float32)

Controls saturation of the material albedo: 0 yields the unmodified material albedo, 1 yields its grayscale variant.

Vertex​Color​Brightness


public readonly attribute VertexColorBrightness → (float32)

Controls brightness of the vertex colors: 0 yields the unmodified vertex color, 1 yields its maximum brightness variant.