Manifold WASM Developer Guide
    Preparing search index...

    Interface GLTFMaterial

    Define a material using the glTF metallic-roughness physically-based rendering model. Materials can be applied to a model through setMaterial(), or set as a GLTFNode property.

    interface GLTFMaterial {
        attributes?: (
            | "POSITION"
            | "NORMAL"
            | "TANGENT"
            | "TEXCOORD_0"
            | "TEXCOORD_1"
            | "COLOR_0"
            | "JOINTS_0"
            | "WEIGHTS_0"
            | "SKIP_1"
            | "SKIP_2"
            | "SKIP_3"
            | "SKIP_4"
        )[];
        roughness?: number;
        metallic?: number;
        baseColorFactor?: [number, number, number];
        alpha?: number;
        unlit?: boolean;
        name?: string;
        sourceMaterial?: Material;
        sourceRunID?: number;
    }
    Index

    Properties

    attributes?: (
        | "POSITION"
        | "NORMAL"
        | "TANGENT"
        | "TEXCOORD_0"
        | "TEXCOORD_1"
        | "COLOR_0"
        | "JOINTS_0"
        | "WEIGHTS_0"
        | "SKIP_1"
        | "SKIP_2"
        | "SKIP_3"
        | "SKIP_4"
    )[]

    Every vertex in a glTF Mesh has a set of attributes. POSITION cannot be specified -- ManifoldCAD will set it internally.

    This array specifies how vertex properties are arranged in memory. For example, a value of ['TEXCOORD_0', 'NORMAL', 'SKIP_2', 'COLOR_0'] would implicitly use property channels 0-2 for position, followed by channels 3-4 for texture, 5-7 for surface normal, ignore 8-9, and 10-12 for color.

    Some properties such as TEXCOORD_0 or COLOR_0 may be set when importing a model that has a texture or material.

    When vertex property COLOR_0 is specified, it will be multiplied against baseColorFactor.

    roughness?: number

    Roughness of the material. Ranges from 0 (smooth, specular) to 1.0 (rough, diffuse).

    0.2
    
    metallic?: number

    Metallic property of the material. Ranges from 0 (dielectric, e.g.: yellow plastic) to 1.0 (conductor, e.g: gold). Generally speaking materials are either one or the other and intermediate values are just for blending.

    1.0 // Metallic
    
    baseColorFactor?: [number, number, number]

    Base colour of the material. RGB values, ranging from 0 to 1.0.

    If the attribute COLOR_0 is specifed, it will be multiplied against baseColorFactor. In this case, use an appropriate value like [1.0, 1.0, 1.0].

    [1.0, 1.0, 0.0] // Yellow
    
    alpha?: number

    Transparency of the material. Ranges from 0 (fully transparent) to 1.0 (fully opaque).

    1.0 // Opaque
    
    unlit?: boolean

    Render model as unlit or shadeless, as opposed to physically based rendering.

    false // Lit and shadowed.
    
    name?: string

    Material name. Will be passed through when exported.

    sourceMaterial?: Material

    If set, this material is a copy of another material on an in-memory glTF model. This is used by importManifold and importModel to pass original materials and textures through manifold.

    sourceRunID?: number

    If set, this material is a copy of another material on an in-memory glTF model. This is used by importManifold and importModel to pass original materials and textures through manifold.