Class TerrainMaterial

Represents layered terrain material.

class TerrainMaterial
  : Material;

Constructors

NameDescription
this (owner) Constructs a new TerrainMaterial object.

Fields

NameTypeDescription
layers dlib.container.array.Array!(dagon.graphics.material.Material,32L)Array of terrain texturing layers, where each layer is a separate material
alphaTestThreshold floatAlpha test threshold (for masked transparency).
baseColorFactor dlib.image.color.Color4fBase color factor (albedo color). Used if baseColorTexture is not specified
baseColorTexture TextureBase color (albedo) texture.
blendMode intBlending mode (opaque, transparent, additive).
celShading boolEnables cel shading (pipeline-specific)
colorWrite boolIf false, disables writing to the color buffer.
depthWrite boolIf false, disables writing to the depth buffer.
emissionEnergy floatEmission energy multiplier.
emissionFactor dlib.image.color.Color4fEmission factor. Multiplied with emissionTexture or used directly if emissionTexture is not specified
emissionTexture TextureEmission texture.
heightFactor floatHeight factor. Used if heightTexture is not specified
heightTexture TextureHeight map texture (for parallax mapping).
invertNormalY boolIf true, invert the Y channel of the normal map.
linearColor boolDoes the baseColor in linear RGB space (true), or in sRGB (false)
maskFactor floatAlpha mask factor (for terrain texturing layer material). Used if maskTexture is not specified
maskTexture TextureAlpha mask texture (for terrain texturing layer material).
metallicFactor floatSurface metallic factor (0 = dielectric, 1 = metal). Used if roughnessMetallicTexture is not specified
name stringThe material name (for identification).
normalFactor dlib.math.vector.Vector!(float,3)Tangent-space normal vector. Used if normalTexture is not specified
normalTexture TextureTangent-space normal map texture.
opacity floatOpacity (alpha value, 0.0 = fully transparent, 1.0 = fully opaque).
outputColor boolIf false, disables G-buffer color output.
outputEmission boolIf false, disables G-buffer emission output.
outputNormal boolIf false, disables G-buffer normal output.
outputPBR boolIf false, disables G-buffer PBR output.
parallaxBias floatParallax mapping bias.
parallaxMode intParallax mapping mode.
parallaxScale floatParallax mapping scale.
rimLight boolEnables rim light (pipeline-specific)
roughnessFactor floatSurface roughness factor (0 = smooth, 1 = rough). Used if roughnessMetallicTexture is not specified
roughnessMetallicTexture TextureRoughness/metallic texture.
shadeless boolIf true, disables all shading (renderer-specific option).
shader ShaderOptional shader used for rendering this material.
shadowFilter intShadow filtering mode.
specularity floatSpecularity factor.
sphericalNormal boolIf true, use spherical normal mapping.
subsurfaceScattering floatSubsurface scattering factor.
sun LightOptional main directional light (sun) affecting this material.
textureMappingMode intTexture mapping mode.
textureTransformation dlib.math.matrix.Matrix!(float,3L)Texture transformation matrix.
useCulling boolIf true, enable backface culling.
useFog boolIf true, the surface is fogged according to Environment object settings
useShadows boolIf true, the surface receives shadows.
textureOffsetInternal dlib.math.vector.Vector!(float,2)Internal texture offset (for UV translation).
textureScalingInternal dlib.math.vector.Vector!(float,2)Internal texture scaling (for UV scaling).

Methods

NameDescription
addLayer () Adds a new layer
bind (state) Binds the material and sets all relevant graphics state for rendering.
isTransparent () Returns true if the material is transparent (blend mode is not opaque).
setSprite (uvSize, uvPosition) Sets the sprite UV size and position for texture atlases.
textureOffset () Gets the current texture offset (UV translation).
textureOffset (v) Sets the texture offset (UV translation).
textureScale () Gets the current texture scaling (UV scaling).
textureScale (s) Sets the texture scaling (UV scaling).
unbind (state) Unbinds the material and restores graphics state.

Description

The TerrainMaterial class manages splat maps, texture layers, and blending parameters used for physically-based terrain shading.