TerrainMaterialParameters
Description
- Derived from
-
RenderEffectParameters abstract
Shared render effect parameters for material-based texturing of the terrain.
The following low-level render effect parameter slots are always defined:
-
'g_materialSettings', RenderEffectParameterType.Vector4 [64]
Material texture settings, indexed by material ID:x := horizontal texture coordinate scale y := vertical texture coordinate scale or 0 for planar mapping z := horizontal displacement scale w := vertical displacement scale or 0 for planar mapping
-
'g_materialOrigin', RenderEffectParameterType.Vector3 [2], mapped to:
#0: Origin, return of Vec.To3F_Delta3
#1: Origin, output of Vec.To3F_Delta3 -
'g_materialTranslate', RenderEffectParameterType.Vector3, mapped to Offset.
-
'g_materialTransform', RenderEffectParameterType.Vector3
Transformation coefficients:x := sin(-Rotation) y := cos(-Rotation) z := Radius
-
'g_materialGridLines', RenderEffectParameterType.Float, mapped to GridLines.
-
'g_materialIds', RenderEffectParameterType.Vector4, mapped to TerrainMaterialSlotParameters.MaterialId of Slot.
-
'g_materialWeights', RenderEffectParameterType.Vector4
Weight mask for material IDs:x := 1 if first material is present, 0 otherwise y := 1 if second material is present, 0 otherwise z := 1 if third material is present, 0 otherwise w := 1 if fourth material is present, 0 otherwise
Mapped to TerrainMaterialSlotParameters.MaterialId of Slot.
-
'g_normalScale', RenderEffectParameterType.Vector2 [4]
Normal vector scale along up-direction, indexed by material slot:x := normal scale for horizontal texture y := normal scale for vertical texture
Mapped to TerrainMaterialSlotParameters.Scale of Slot.
-
'g_materialBlendH', RenderEffectParameterType.Vector4 [4]
Material albedo blend coefficients for horizontal texture, indexed by material slot:x := blend factor for material albedo y := blend factor for vertex color z := saturation of the material albedo w := brightness of the vertex colors
Mapped to TerrainMaterialSlotParameters.BlendHorizontal of Slot.
-
'g_materialBlendV', RenderEffectParameterType.Vector4 [4]
Material albedo blend coefficients for vertical texture, indexed by material slot:x := blend factor for material albedo y := blend factor for vertex color z := saturation of the material albedo w := brightness of the vertex colors
Mapped to TerrainMaterialSlotParameters.BlendVertical of Slot.
-
'g_material', RenderEffectParameterType.Texture2D [16]
The material textures (N := material index in [0..3], M := FlagMaterialCountMask).
Albedo/Reflectivity texture:g_material[N * 2 + M * 0 + 0] := horizontal g_material[N * 2 + M * 2 + 0] := vertical
Normal/AmbientOcclusion/Roughness texture:
g_material[N * 2 + M * 0 + 1] := horizontal g_material[N * 2 + M * 2 + 1] := vertical
The following low-level render effect parameter slots are omitted if FlagNoDisplacement is present:
-
'g_displacementInfo', RenderEffectParameterType.Vector2
Information about the horizontal and vertical displacement texture arrays:
x
andy
are mapped to mapped to DisplacementIndex.
z
maps to the width of DisplacementHorizontal.
w
maps to the width of DisplacementVertical. -
'g_materialHeightBlend', RenderEffectParameterType.Vector3, mapped to TerrainLayerMaterial.HeightBlend.
-
'g_displacementSettings', RenderEffectParameterType.Vector2, mapped to DisplacementSettings.
-
'g_displacement', RenderEffectParameterType.Texture2D [2]
Displacement texture arrays:#0: horizontal, index by material ID minus DisplacementIndex.X #1: vertical, index by material ID minus DisplacementIndex.Y
Mapped to DisplacementHorizontal and DisplacementVertical.
Public / Constants
FlagMaterialCountMask
Bitmask for extracting the material count from the flags that have been passed to RenderEffectParameters.Declare.
The material count must be in the range [1..3].
FlagNoDisplacement
When present, low-level render effect parameter slots that are related to displacement mapping will be omitted.
- See also
Public / Attributes
DisplacementIndex
Material ID of the first slice of the displacement texture arrays.
Defaults to Vec2I.Zero.
Origin
Point in terrain-space that is subtracted from the vertex position before calculating material coordinates.
Defaults to Vec3D.Zero.
Vertical
The terrain texture parameters for the vertical planes, indexed by material ID.
A terrain material will be rendered with planar texture mapping iff its vertical texture is empty (see TerrainMaterialTextureParameters.IsEmpty). Otherwise, it will be rendered with tri-planar texture mapping.