Types - Material
API reference for ./evaluate/material on @huukhanhnguyen/types.
See the Guide for the package's role.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
Material
type
type Material
// = {
name: string;
baseColor?: 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. */
texture?: string;
/** Normal map (URI or texture key) — real light-responsive relief.
* Sampled linear (never sRGB); shares tileWidth/tileHeight. */
normalTexture?: string;
/** Roughness map (URI or texture key) — grayscale, green channel read
* per glTF convention; shares tileWidth/tileHeight. */
roughnessTexture?: string;
/** Metallic map (URI or texture key) — grayscale, blue channel read per
* glTF convention; shares tileWidth/tileHeight. */
metallicTexture?: 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). */
displacementTexture?: string;
/** Displacement amplitude in mm (three displacementScale). Default 1. */
displacementScale?: number;
/** Ambient-occlusion map (URI or texture key) — grayscale multiplier on
* ambient/indirect light; shares tileWidth/tileHeight. */
aoTexture?: string;
/** 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. */
tileWidth?: number;
tileHeight?: number;
/** 0 = white tint (texture shows through fully), 1 = solid baseColor. Default 1. */
colorFactor?: number;
opacity?: number;
roughness?: number;
metallic?: 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). */
alphaTest?: number;
/** 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). */
alphaMode?: "OPAQUE" | "MASK" | "BLEND";
/** Emissive (self-lit) color, hex — glTF emissiveFactor. */
emissive?: string;
/** Emissive map (URI or texture key, same convention as `texture`). */
emissiveTexture?: string;
/** Emissive strength multiplier (glTF KHR_materials_emissive_strength). Default 1. */
emissiveIntensity?: number;
/** Render both faces of a surface (glTF doubleSided) — thin imported
* geometry (a leaf, a curtain) has no solid thickness to close it. */
doubleSided?: boolean;
/** KHR_materials_transmission — 0..1. Glass walls need this (opacity alone
* is frosted plastic). */
transmission?: number;
/** KHR_materials_volume thickness in mm (optical path length). */
thickness?: number;
/** KHR_materials_volume attenuation color, hex. */
attenuationColor?: string;
/** KHR_materials_volume attenuation distance (mm). */
attenuationDistance?: number;
/** KHR_materials_ior — glass ≈ 1.5. */
ior?: number;
/** KHR_materials_clearcoat — varnish / gloss paint, 0..1. */
clearcoat?: number;
clearcoatRoughness?: number;
/** KHR_materials_sheen — fabric/upholstery color, hex. */
sheenColor?: string;
sheenRoughness?: number;
/**
* 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.
*/
attributes?: Record<string, unknown>;
/** Section-cut face fill pattern — the pattern alone; its surface is
* stamped from the cut face at expand time. */
cutPattern?: MaterialPattern;
/** Plan/elevation face fill pattern — same thing, other face. */
surfacePattern?: MaterialPattern;
}MaterialData
type
A Material with its texture chains RESOLVED to pixels — what an evaluation hands the interchange writers. The *TextureData fields are attached at evaluate time when the matching texture / normalTexture / roughnessTexture / … names a texture key.
type MaterialData
// = Material & { textureData?: TextureData; normalTextureData?: TextureData; roughnessTextureData?: TextureData; metallicTextureData?: TextureData; displacementTextureData?: TextureData; aoTextureData?: TextureData; emissiveTextureData?: TextureData; /** Runtime-only (never persisted): flipY override for a URI `texture`. A * glTF-sourced map is top-left-origin and needs false. */ textureFlipY?: boolean; }MaterialPattern
type
A material's fill pattern — a Hatch that has not been given its face yet. DERIVED from Hatch rather than restated: the two carried the same five fields until 2026-08-14, and the copies here had also lost the Vector2d spelling of basis, writing [[number, number], [number,
number]] by hand. A material names a pattern; WHICH face it fills is decided at expand time (the section cut stamps the surface from the cut face), so face is the one thing this cannot carry — and the only thing it drops.
type MaterialPattern
// = Omit<Hatch, "face">