Interface SceneMaterialParams

interface SceneMaterialParams {
    alphaCutoff?: number;
    alphaMode?: "OPAQUE" | "MASK" | "BLEND";
    color?: Vec3;
    colorTextureId?: string;
    emissiveTextureId?: string;
    hatchPattern?: HatchStyle | HatchParams;
    id: string;
    linePattern?: number[] | model.scene.LineStyle;
    lineWidth?: number;
    metallic?: number;
    metallicRoughnessTextureId?: string;
    normalsTextureId?: string;
    occlusionTextureId?: string;
    opacity?: number;
    roughness?: number;
    triplanarScale?: number;
}

Properties

alphaCutoff?: number

Cut-off threshold used when alphaMode is "MASK". Fragments with albedoAlpha < alphaCutoff are discarded. Default is 0.5.

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

Alpha-handling mode (matches the glTF 2.0 alphaMode semantics):

  • "OPAQUE" — alpha channel is ignored. Default.
  • "MASK" — fragments with albedoAlpha < alphaCutoff are discarded. Used for cutout foliage, fences, etc.
  • "BLEND" — alpha contributes to the output and the fragment is alpha-blended into the framebuffer.

For MASK / BLEND, the alpha source is the A channel of the bound colorTexture multiplied by opacity.

color?: Vec3

Color of the material, as RGB components in the range 0.0 to 1.0.

colorTextureId?: string

ID of a color texture created previously with SceneModel.createTexture.

A color texture has color in RGB and alpha in A.

emissiveTextureId?: string

ID of an emissive color texture created previously with SceneModel.createTexture.

An emissive texture has RGBA components, with emissive factors in RGB.

hatchPattern?: HatchStyle | HatchParams

Hatch pattern for triangle-surface meshes that carry this material. Accepts either a named preset from HatchStyle or a HatchParams object that specifies one to four line families plus a hatch ink colour and opacity.

Hatches are the engineering analog of linePattern: they paint a regular set of parallel ink lines over the lit surface to indicate a material class (concrete, steel, brick, masonry) on a cross-section or elevation drawing. Patterns are applied in screen space — the lines stay at constant pixel thickness and spacing regardless of surface depth or orientation.

Default is "solid" — no hatch, surface renders normally.

Affects visual appearance only; picking treats the surface as continuous regardless of the pattern.

id: string

ID for the texture set.

linePattern?: number[] | model.scene.LineStyle

Dash / gap pattern for line-primitive meshes that carry this material. Accepts either a named preset from LineStyle or a custom [dash, gap, dash, gap, …] array (up to 8 entries, units of line-width).

Pattern entries are measured in line-width units so visual proportions stay constant as lineWidth changes: [3, 2] reads as "dash 3 × lineWidth, gap 2 × lineWidth".

Default is "solid" — continuous line. Setting any other value overrides the View-level lines-material pattern for meshes that carry this material, so engineering conventions (hidden, centre, phantom) can be mixed within a single drawing.

Affects visual appearance only; picking treats the line as continuous regardless of the pattern.

lineWidth?: number

Pixel thickness for line-primitive meshes that carry this material. Consumed by the thick-line draw technique, which quad-expands every line in the vertex shader and offsets each side by half this width.

Default 0, which means "fall back to the View's linesMaterial.lineWidth". Setting a positive value overrides that fallback per-material so different line-primitive meshes can be drawn at different thicknesses in the same View.

metallic?: number

How metallic the surface is, in [0, 1]. 0 is a dielectric (plastic, stone, paint); 1 is a pure metal whose diffuse term is suppressed and whose Fresnel base reflectance is tinted by color (or by the sampled colour texture, when one is bound).

Only consulted on the smooth-shaded path.

Default is 0.0.

metallicRoughnessTextureId?: string

ID of a metallic-roughness texture created previously with SceneModel.createTexture.

A metallic-roughness texture has RGBA components, with the metallic factor in R, and the roughness factor in G.

normalsTextureId?: string

ID of a normal map texture created previously with SceneModel.createTexture.

A normal map texture has RGBA components, with the normal map vectors in RGB.

occlusionTextureId?: string

ID of an ambient occlusion texture created previously with SceneModel.createTexture.

An occlusion texture has RGBA components, with occlusion factor in R,

opacity?: number

Opacity of the material, in the range 0.0 to 1.0.

roughness?: number

Microfacet roughness used by the renderer's Cook-Torrance BRDF.

0 is mirror-smooth, 1 is fully diffuse. Only consulted on the smooth-shaded path (geometry with per-vertex normals); flat-shaded meshes ignore this value.

Default is 0.6 — moderately rough, looks like painted plaster.

triplanarScale?: number

World-space repeat distance used by a renderer's triplanar texture-sampling fallback, in scene units per texture repeat.

Triplanar fallback should engage automatically for any mesh that carries this material when the mesh's geometry has no UV coordinates — typical of BIM, sweeps, lofted pipes, and generated curve meshes. Each fragment derives its sample coordinates from world-space position rather than vertex UVs, so the texture appears at a fixed physical scale regardless of mesh scale or geometry layout.

Materials whose meshes all carry UVs ignore this value.

Default is 1.0 — one texture repeat per scene unit.