Skip to content
Shapemetry

@huukhanhnguyen/types / evaluate/material

evaluate/material

Material

Material = { alphaMode?: "OPAQUE" | "MASK" | "BLEND"; alphaTest?: number; aoTexture?: string; attenuationColor?: string; attenuationDistance?: number; attributes?: Record<string, unknown>; baseColor?: string; clearcoat?: number; clearcoatRoughness?: number; colorFactor?: number; cutPattern?: string; displacementScale?: number; displacementTexture?: string; doubleSided?: boolean; emissive?: string; emissiveIntensity?: number; emissiveTexture?: string; ior?: number; metallic?: number; metallicTexture?: string; name: string; normalTexture?: string; opacity?: number; roughness?: number; roughnessTexture?: string; sheenColor?: string; sheenRoughness?: number; surfacePattern?: string; texture?: string; thickness?: number; tileHeight?: number; tileWidth?: number; transmission?: number; }

alphaMode?

optional alphaMode?: "OPAQUE" | "MASK" | "BLEND"

glTF alphaMode — the EXPLICIT statement, which wins over the inference when present: "MASK" reads alphaTest (default threshold 0.5), "BLEND" reads opacity, "OPAQUE" ignores both. Absent = inferred from the two fields above (alphaTest set → cutout; opacity < 1 → blend).

alphaTest?

optional alphaTest?: number

Alpha-cutout threshold (0..1) for a billboard/foliage-style texture — pixels below this alpha are fully discarded (glTF alphaMode "MASK"), not blended. Unset = no cutout (opaque, or opacity-blended).

aoTexture?

optional aoTexture?: string

Ambient-occlusion map (URI or texture key) — grayscale multiplier on ambient/indirect light; shares tileWidth/tileHeight.

attenuationColor?

optional attenuationColor?: string

KHR_materials_volume attenuation color, hex.

attenuationDistance?

optional attenuationDistance?: number

KHR_materials_volume attenuation distance (mm).

attributes?

optional attributes?: Record<string, unknown>

Domain attribute bag (classify-by-data). Documented keys:

  • kFactor?: number — sheet-metal bend K-factor (ANSI)
  • density?: number — kg/mm³ material mass density Core never grows domain fields as first-class Material props.

baseColor?

optional baseColor?: string

clearcoat?

optional clearcoat?: number

KHR_materials_clearcoat — varnish / gloss paint, 0..1.

clearcoatRoughness?

optional clearcoatRoughness?: number

colorFactor?

optional colorFactor?: number

0 = white tint (texture shows through fully), 1 = solid baseColor. Default 1.

cutPattern?

optional cutPattern?: string

The patterns[] record drawn where a SECTION CUTS this material, BY NAME. The region comes from the cut itself, at stamp time.

A name and not a hatch-shaped object: everything a hatch carries beside the name says WHERE the pattern sits, and a material knows no region to sit in. Carrying the placement knobs here made a second, half-usable spelling of a hatch that nothing could author.

displacementScale?

optional displacementScale?: number

Displacement amplitude in mm (three displacementScale). Default 1.

displacementTexture?

optional displacementTexture?: string

Displacement/height map (URI or texture key) — grayscale, displaces vertices along their normals. Only visible on tessellated/dense geometry (a 2-triangle face has no vertices to move — use the displace geometry op for real relief there).

doubleSided?

optional doubleSided?: boolean

Render both faces of a surface (glTF doubleSided) — thin imported geometry (a leaf, a curtain) has no solid thickness to close it.

emissive?

optional emissive?: string

Emissive (self-lit) color, hex — glTF emissiveFactor.

emissiveIntensity?

optional emissiveIntensity?: number

Emissive strength multiplier (glTF KHR_materials_emissive_strength). Default 1.

emissiveTexture?

optional emissiveTexture?: string

Emissive map (URI or texture key, same convention as texture).

ior?

optional ior?: number

KHR_materials_ior — glass ≈ 1.5.

metallic?

optional metallic?: number

metallicTexture?

optional metallicTexture?: string

Metallic map (URI or texture key) — grayscale, blue channel read per glTF convention; shares tileWidth/tileHeight.

name

name: string

normalTexture?

optional normalTexture?: string

Normal map (URI or texture key) — real light-responsive relief. Sampled linear (never sRGB); shares tileWidth/tileHeight.

opacity?

optional opacity?: number

roughness?

optional roughness?: number

roughnessTexture?

optional roughnessTexture?: string

Roughness map (URI or texture key) — grayscale, green channel read per glTF convention; shares tileWidth/tileHeight.

sheenColor?

optional sheenColor?: string

KHR_materials_sheen — fabric/upholstery color, hex.

sheenRoughness?

optional sheenRoughness?: number

surfacePattern?

optional surfacePattern?: string

The patterns[] record drawn where a face is seen UNCUT — the elevation hatch. Same rule as Material.cutPattern.

texture?

optional texture?: string

Texture image as a URI (https:// or data:) or a processors key — images have no lane of their own; the string itself is the reference.

thickness?

optional thickness?: number

KHR_materials_volume thickness in mm (optical path length).

tileHeight?

optional tileHeight?: number

tileWidth?

optional tileWidth?: number

Physical size (mm) of ONE seamless texture tile — face UVs are plane millimetres, so the renderer shows the texture at REAL size regardless of geometry dimensions (repeat = 1/tile). FALLBACK only: a textures[] chain declares its physical size via its builtin lengthX/lengthY parameters (the tile's size is intrinsic to the tile), which ride TextureData and win over these; declare here for plain URI textures, which have no record of their own. Default 1000.

transmission?

optional transmission?: number

KHR_materials_transmission — 0..1. Glass walls need this (opacity alone is frosted plastic).


MaterialData

MaterialData = Material & { aoTextureData?: TextureData; displacementTextureData?: TextureData; emissiveTextureData?: TextureData; metallicTextureData?: TextureData; normalTextureData?: TextureData; roughnessTextureData?: TextureData; textureData?: TextureData; textureFlipY?: boolean; }

A Material with its texture chains RESOLVED to pixels — what an evaluation hands a consumer that needs pixels. The *TextureData fields are attached at evaluate time when the matching texture / normalTexture / roughnessTexture / … names a texture key.

Last updated: 📖 5 min readEdit on GitHub