Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Configuration for mesh material creation.

    The compositing half (opacity / gamma / intensity / offset / blendingMode / depthTest / transparent / colormapTexture / scalarRange) mirrors PointMaterialConfig field for field, so the layers panel and the material-sync path treat all four geometry types identically.

    What differs is named rather than silently omitted:

    • no absorption / hasElementAlpha — both exist only to serve the volumetric mode, which a zero-thickness surface cannot express (§6.3);
    • no radiusScale / truncationRadius — those normalize a per-element extent, and a triangle's extent is its own vertices;
    • flatNormal, the four lighting controls and alphaCutoff are new, because mesh is the first shaded type and the first with a cutout.
    interface MeshMaterialConfig {
        opacity?: number;
        gamma?: number;
        intensity?: number;
        offset?: number;
        blendingMode?: BlendingModeName;
        shading?: MeshShadingMode;
        baseColorTexture?: Texture<unknown, TextureEventMap>;
        baseColorTextureLuminance?: boolean;
        ambient?: number;
        shadeExponent?: number;
        specular?: number;
        shininess?: number;
        alphaCutoff?: number;
        depthTest?: boolean;
        transparent?: boolean;
        colormapTexture?: DataTexture;
        scalarRange?: [number, number];
    }
    Index
    opacity?: number
    gamma?: number
    intensity?: number

    Linear colour multiplier (gain), default 1.0.

    offset?: number

    Additive brightness shift (black level), default 0.0.

    blendingMode?: BlendingModeName

    Luxar blending mode. Default 'opaque' — the MESH default, unlike the three siblings' 'additive'. opaque is the only mode unconditionally correct without per-triangle depth sorting, and it is what a surface should look like (§6.3). 'volumetric' is mapped to 'opaque'; see resolveMeshBlendingMode.

    shading?: MeshShadingMode

    How normals are obtained: stored, derivative, or none at all.

    A compile-time variant, not a runtime branch — see MeshTSLConfig.shading for why, and createMeshNode for who decides it.

    Replaced the earlier flatNormal boolean when 'none' arrived. Two booleans would admit a meaningless flatNormal && noShading state and double the variant count for something with one behaviour; an enum makes the invalid combination not exist.

    baseColorTexture?: Texture<unknown, TextureEventMap>

    Base-colour texture, sampled per fragment through the uv attribute.

    The third and most specific base-colour source: it WINS over colormapTexture, because a colormap can be switched on at runtime by the layers panel for any node with scalars while a texture only exists if the store carried an image and its UVs. Exactly one source is ever active — see syncMeshColorSourceDefines.

    baseColorTextureLuminance?: boolean

    Whether baseColorTexture is single-channel, so the shader must replicate red to RGB.

    A 1-channel texture uploads as RedFormat and samples as (r, 0, 0, 1), so without this a greyscale basemap renders pure red. Carried as a flag rather than read off the texture's format so the material never has to reach into the upload's choices.

    ambient?: number

    Wrapped-diffuse shade floor; default MESH_DEFAULTS.ambient.

    shadeExponent?: number

    Wrapped-diffuse exponent; default MESH_DEFAULTS.shadeExponent.

    specular?: number

    Additive specular strength; default MESH_DEFAULTS.specular.

    shininess?: number

    Specular exponent; default MESH_DEFAULTS.shininess.

    alphaCutoff?: number

    opaque-mode cutout threshold; default MESH_DEFAULTS.alphaCutoff.

    depthTest?: boolean
    transparent?: boolean
    colormapTexture?: DataTexture

    Colormap LUT texture (256x1 RGB).

    scalarRange?: [number, number]

    Scalar data range [min, max] for normalization.