@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?
optionalalphaMode?:"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?
optionalalphaTest?: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?
optionalaoTexture?:string
Ambient-occlusion map (URI or texture key) — grayscale multiplier on ambient/indirect light; shares tileWidth/tileHeight.
attenuationColor?
optionalattenuationColor?:string
KHR_materials_volume attenuation color, hex.
attenuationDistance?
optionalattenuationDistance?:number
KHR_materials_volume attenuation distance (mm).
attributes?
optionalattributes?: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?
optionalbaseColor?:string
clearcoat?
optionalclearcoat?:number
KHR_materials_clearcoat — varnish / gloss paint, 0..1.
clearcoatRoughness?
optionalclearcoatRoughness?:number
colorFactor?
optionalcolorFactor?:number
0 = white tint (texture shows through fully), 1 = solid baseColor. Default 1.
cutPattern?
optionalcutPattern?: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?
optionaldisplacementScale?:number
Displacement amplitude in mm (three displacementScale). Default 1.
displacementTexture?
optionaldisplacementTexture?: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?
optionaldoubleSided?:boolean
Render both faces of a surface (glTF doubleSided) — thin imported geometry (a leaf, a curtain) has no solid thickness to close it.
emissive?
optionalemissive?:string
Emissive (self-lit) color, hex — glTF emissiveFactor.
emissiveIntensity?
optionalemissiveIntensity?:number
Emissive strength multiplier (glTF KHR_materials_emissive_strength). Default 1.
emissiveTexture?
optionalemissiveTexture?:string
Emissive map (URI or texture key, same convention as texture).
ior?
optionalior?:number
KHR_materials_ior — glass ≈ 1.5.
metallic?
optionalmetallic?:number
metallicTexture?
optionalmetallicTexture?:string
Metallic map (URI or texture key) — grayscale, blue channel read per glTF convention; shares tileWidth/tileHeight.
name
name:
string
normalTexture?
optionalnormalTexture?:string
Normal map (URI or texture key) — real light-responsive relief. Sampled linear (never sRGB); shares tileWidth/tileHeight.
opacity?
optionalopacity?:number
roughness?
optionalroughness?:number
roughnessTexture?
optionalroughnessTexture?:string
Roughness map (URI or texture key) — grayscale, green channel read per glTF convention; shares tileWidth/tileHeight.
sheenColor?
optionalsheenColor?:string
KHR_materials_sheen — fabric/upholstery color, hex.
sheenRoughness?
optionalsheenRoughness?:number
surfacePattern?
optionalsurfacePattern?:string
The patterns[] record drawn where a face is seen UNCUT — the elevation hatch. Same rule as Material.cutPattern.
texture?
optionaltexture?: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?
optionalthickness?:number
KHR_materials_volume thickness in mm (optical path length).
tileHeight?
optionaltileHeight?:number
tileWidth?
optionaltileWidth?: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?
optionaltransmission?: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.