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

Apply


public method Apply → (8)

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.

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.

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

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 inverse 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 inverse 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 → (3)

slot in : int32

The terrain layer slot index.

value opt : int32 = 3

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

inverse opt : bool = true

Use inverse material value?

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 terrain material mapping has been specified,
false if not.

Has a terrain material mapping been specified via Albedo?

Has​Glossiness


public attribute HasGlossiness → (get)

value : bool

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

Has a 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 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 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 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 terrain material mapping been specified via Reflectivity?