TerrainMaterialBlend

Description

struct Tinman.Engine.Components.TerrainMaterialBlend

A set of coefficients that control how material albedo and vertex 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
finalColor     =   (1 - BlendMaterial - BlendVertex) * A * B
                 + BlendMaterial                     * A
                 + BlendVertex                       * B

Public / Constants

MaterialModulate


public static readonly attribute MaterialModulate → (TerrainMaterialBlend)

Modulates material albedo with maximum-brightness vertex color.

MaterialOnly


public static readonly attribute MaterialOnly → (TerrainMaterialBlend)

Material albedo only.

VertexModulate


public static readonly attribute VertexModulate → (TerrainMaterialBlend)

Modulates maximum-brightness vertex color with grayscale material albedo.

VertexOnly


public static readonly attribute VertexOnly → (TerrainMaterialBlend)

Vertex color only.

Public / Constructors

TerrainMaterialBlend


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

BlendMaterial


public readonly attribute BlendMaterial → (float32)

Blend factor for material albedo.

BlendVertex


public readonly attribute BlendVertex → (float32)

Blend factor for vertex color.

MaterialAlbedoGrayscale


public readonly attribute MaterialAlbedoGrayscale → (float32)

Controls saturation of the material albedo.

VertexColorBrightness


public readonly attribute VertexColorBrightness → (float32)

Controls brightness of the vertex colors.