Skip to content

dh.material

Extension: .dh-matType ID: dh.material

Materials define surface appearance — textures, PBR properties, tint, and transparency. DigitalHeaven materials use semantic properties that map to platform-specific shaders at build time.

PropertyTypeRequiredDescription
$type"dh.material"noType identifier
namestringnoDisplay name
descriptionstringnoDescription
inheritsstringnoBarcode of the material to inherit from
texturesobjectnoTexture channel assignments
propertiesobjectnoFloat material properties
tintcolornoBase color multiplier (RGBA)
alphaModestringnoAlpha rendering mode
alphaCutofffloatnoCutoff threshold for "mask" mode (default: 0.5)

The type is inferred from the file extension — $type is not needed in source files. The compiler adds it automatically during builds.

glass.dh-mat
{
"name": "Glass",
"textures": {
"baseColor": "textures/glass-albedo.png",
"normal": "textures/glass-normal.png",
"metallicRoughness": "textures/glass-pbr.png"
},
"properties": {
"metallic": 0.0,
"smoothness": 0.95
},
"tint": [0.9, 0.95, 1.0, 0.5],
"alphaMode": "blend"
}

The textures object maps semantic channel names to texture file paths:

ChannelDescription
baseColorAlbedo / diffuse color
normalNormal map
metallicRoughnessCombined metallic-roughness (glTF style)
occlusionAmbient occlusion
emissiveEmissive / glow map

Paths are relative to the pallet root, or barcodes for cross-pallet references.

You can reference individual channels from packed textures using @channel syntax:

skin.dh-mat
{
"textures": {
"metallic": "textures/packed-orm.png@b",
"roughness": "textures/packed-orm.png@g",
"occlusion": "textures/packed-orm.png@r"
}
}

The compiler extracts the specified channel at build time and generates a separate grayscale texture. Valid channels: r, g, b, a.

See dh.texture for more on channel operations.

PropertyRangeDescription
metallic0.0 – 1.0How metallic the surface is
roughness0.0 – 1.0Surface roughness (1.0 = fully rough)
smoothness0.0 – 1.0Inverse of roughness (1.0 = mirror-smooth)
normalScaleanyNormal map intensity multiplier
occlusionStrength0.0 – 1.0Ambient occlusion strength
emissiveIntensityanyEmissive brightness multiplier

Use either roughness or smoothness, not both. They’re inverses of each other.

The tint property is an RGBA color multiplier applied to the base color texture. If there’s no base color texture, tint defines the solid color.

finalColor = texture * tint

Two formats:

Array (RGBA floats, 0–1):

{ "tint": [1.0, 0.5, 0.5, 0.8] }

Hex string (RGB or RGBA):

{ "tint": "#FF8080CC" }
{ "tint": "#FF8080" }

Hex without alpha defaults to fully opaque (FF).

The alphaMode property controls transparency rendering. Follows the glTF specification.

ModeDescription
"opaque"Fully opaque, alpha is ignored (default)
"mask"Binary transparency — pixels are either fully visible or fully invisible based on alphaCutoff
"blend"Smooth alpha blending with the background

Cutout (foliage, hair cards):

{
"alphaMode": "mask",
"alphaCutoff": 0.5
}

Transparent (glass, water):

{
"alphaMode": "blend",
"tint": [1.0, 1.0, 1.0, 0.5]
}

When alphaMode is omitted, platform loaders may auto-infer:

  • Unity: If tint alpha is less than 1.0, automatically uses blend mode
  • To override, explicitly set alphaMode

For Unity-specific shader settings, use platform overrides with raw shader property names:

materials/glass.dh-mat # Universal material
platforms/unity/materials/glass.dh-mat # Unity-specific overrides

Unity override example:

platforms/unity/materials/glass.dh-mat
{
"shader": "Standard",
"properties": {
"_Metallic": 0.0,
"_Mode": "transparent"
},
"colors": {
"_Color": [1.0, 1.0, 1.0, 0.5]
}
}

The _Mode property accepts string values:

ValueDescription
"opaque"Standard opaque rendering
"cutout"Binary transparency using alpha cutoff
"fade"Alpha blending (fades out specular/reflections)
"transparent"Alpha blending (preserves specular/reflections)

Numeric values (0–3) also work.