TerrainSlotMapping

Description

struct Tinman.Engine.Components.TerrainSlotMapping

Specifies the mapping from texture atlas samples to terrain material values.

To define a mapping, begin with Default and successively add the mappings you need. Mappings can be specified for the following terrain material values, which refer to the specular-glossiness PBR workflow (see IMaterial):

Terrain layer slot indices are expected to be in the range [0..SlotCount-1] or one of the special slot values: SlotBlack, SlotVertex. Component indices of texture atlas samples are expected to be in the range [0..3], referring to the red, green, blue and alpha channels, respectively. If a slot index and/or a component index is outside of its expected range, the default material value will be used.

Public / Constants

Default


public static readonly attribute Default → (TerrainSlotMapping)

Predefined terrain material that uses the default material values.

Slot​Black


public constant SlotBlack → (3:int32)

An auxiliary terrain layer slot that has a uniform texture sample value of (0,0,0,1).

Slot​Count


public constant SlotCount → (3:int32)

The maximum number of terrain layer slots.

Slot​Vertex


public constant SlotVertex → (4:int32)

An auxiliary terrain layer slot that has a value that is equal to the per-vertex color.

See also

Semantic.Texture

Public / Methods

Albedo


[Pure]
public method Albedo → (4)

slot in : int32

The terrain layer slot index.

red opt : int32 = 0

The component index in the texture atlas sample for the red channel of the albedo color.

green opt : int32 = 1

The component index in the texture atlas sample for the green channel of the albedo color.

blue opt : int32 = 2

The component index in the texture atlas sample for the blue channel of the albedo color.

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: albedo (sRGB).

The default material value is (1,1,1), i.e. opaque white.

Apply


public method Apply → (12)

effect in : IRenderEffectParameters

[not-null]
The render effect.

slotTerrainData in : int32

Parameter slot index of 'g_terrainData', see TerrainTextureParameters.

slotMaterialAlbedo in : int32

Parameter slot index of 'g_materialAlbedo', see TerrainTextureParameters.

slotMaterialEmissive in : int32

Parameter slot index of 'g_materialEmissive', see TerrainTextureParameters.

slotMaterialEmissiveColor in : int32

Parameter slot index of 'g_materialEmissiveColor', see TerrainTextureParameters.

slotMaterialEmissiveFade in : int32

Parameter slot index of 'g_materialEmissiveFade', see TerrainTextureParameters.

slotMaterialGloss in : int32

Parameter slot index of 'g_materialGloss', see TerrainTextureParameters.

slotMaterialNormal in : int32

Parameter slot index of 'g_materialNormal', see TerrainTextureParameters.

slotMaterialOcclusion in : int32

Parameter slot index of 'g_materialOcclusion', see TerrainTextureParameters.

slotMaterialOpacity in : int32

Parameter slot index of 'g_materialOpacity', see TerrainTextureParameters.

slotMaterialReflectivity in : int32

Parameter slot index of 'g_materialReflectivity', see TerrainTextureParameters.

slotMaterialReflectivityColor in : int32

Parameter slot index of 'g_materialReflectivityColor', see TerrainTextureParameters.

Applies the mapping from texture atlas samples to terrain material values.

The X-component of each material slots (see parameters) refers to the texture sample of a terrain layer slot (see TerrainLayerTexture.Slot). The component indices refer to the X-, Y-, Z- or W-component of the texture sample (index values 0, 1, 2 and 3, respectively). Some material slots provide a scale factor and value offset, which are applied to the texture sample component: value = sample * factor + offset

Emissive


[Pure]
public method Emissive → (5)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

The component index in the texture atlas sample for the emissive light intensity.

inverse opt : bool = false

Use inverse material value?

color opt : int64 = Colors.White

The emissive color.

fade opt : Fade = default(Fade)

Optional fade-out range to use. The cosine of the angle between the surface normal of the base terrain and the direction vector towards the prominent light source is used as the input value for Fade.Compute, for example: +1 (0°) = light is at the zenith, 0 (90°) = light is at the horizon, -1 (180°) = light is at the nadir. The computed fade value is used to reduce the emissive light intensity, where a fade value or 0 means full strength and 1 means zero strength. Defaults to Fade.AlwaysZero.

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: emissive light intensity (linear).

The default material value is 0, i.e. no emissive light.

Glossiness


[Pure]
public method Glossiness → (3)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

The component index in the texture atlas sample for the gloss value.

inverse opt : bool = true

Use inverse material value?

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: gloss (linear).

The default material value is 0, i.e. no glossiness.

Normal


[Pure]
public method Normal → (4)

slot in : int32

The terrain layer slot index.

opt : int32 = 0

The component index in the texture atlas sample for the normal X-component.

opt : int32 = 1

The component index in the texture atlas sample for the normal Y-component.

opt : int32 = 2

The component index in the texture atlas sample for the normal Z-component.

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: normal vector (linear).

Since the terrain is textured uniquely, there is no need to store normal vectors in tangent-space. Instead, normal vectors are stored in terrain-space. Thus, tangent and bitangent vectors are not required for unique terrain texturing.

The default material value is (0,1,0), i.e. pointing straight up for Geometry.Plane.

See also

IMaterial.Normal

Occlusion


[Pure]
public method Occlusion → (3)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

The component index in the texture atlas sample for the ambient occlusion value.

inverse opt : bool = false

Use inverse material value?

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: ambient occlusion (linear).

The default material value is 1, i.e. no ambient occlusion resp. full ambient lighting.

Opacity


[Pure]
public method Opacity → (3)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

The component index in the texture atlas sample for the opacity value.

inverse opt : bool = false

Use inverse material value?

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: opacity (linear).

The default material value is 1, i.e. fully opaque.

Reflectivity


[Pure]
public method Reflectivity → (4)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

The component index in the texture atlas sample for the grayscale reflectivity value.

inverse opt : bool = true

Use inverse material value?

color opt : int64 = Colors.White

The reflective color.

returns → TerrainSlotMapping

The resulting mapping.

Specifies the terrain material mapping for: grayscale reflectivity (linear).

The default material value is 0, i.e. no reflectivity.

Public / Attributes

Has​Albedo


public attribute HasAlbedo → (get)

value : bool

true if a non-default terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Albedo?

Has​Emissive


public attribute HasEmissive → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Emissive?

Has​Glossiness


public attribute HasGlossiness → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Glossiness?

Has​Normal


public attribute HasNormal → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Normal?

Has​Occlusion


public attribute HasOcclusion → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Occlusion?

Has​Opacity


public attribute HasOpacity → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Opacity?

Has​Reflectivity


public attribute HasReflectivity → (get)

value : bool

true if a terrain material mapping has been specified,
false if not.

Has a non-default terrain material mapping been specified via Reflectivity?