Interface IMaterial<E, ET>

interface IMaterial<
    E extends IMaterialEvent = IMaterialEvent,
    ET = IMaterialEventTypes,
> {
    __matExtUiConfigs?: Record<string, undefined | UiObjectConfig>;
    alphaMap?: null | ITexture;
    aoMap?: null | ITexture;
    aoMapIntensity?: number;
    appliedMeshes: Set<IObject3D>;
    assetType: "material";
    bumpMap?: null | ITexture;
    color?: Color;
    constructor: {
        MaterialProperties?: Record<string, any>;
        MaterialTemplate?: IMaterialTemplate;
        TYPE: string;
        TypeSlug: string;
    };
    displacementMap?: null
    | ITexture;
    envMap?: null | ITexture;
    envMapIntensity?: number;
    extraUniformsToUpload: Record<string, IUniform>;
    flatShading?: boolean;
    generator?: IMaterialGenerator<IMaterial>;
    isGBufferMaterial?: boolean;
    isPhysicalMaterial?: boolean;
    isRawShaderMaterial?: boolean;
    isUnlitMaterial?: boolean;
    lastShader?: Shader;
    lightMap?: null | ITexture;
    lightMapIntensity?: number;
    linewidth?: number;
    map?: null | ITexture;
    materialExtensions: MaterialExtension[];
    metalness?: number;
    metalnessMap?: null | ITexture;
    needsUpdate: boolean;
    normalMap?: null | ITexture;
    registerMaterialExtensions: (
        customMaterialExtensions: MaterialExtension[],
    ) => void;
    roughness?: number;
    roughnessMap?: null | ITexture;
    transmission?: number;
    transmissionMap?: null | ITexture;
    unregisterMaterialExtensions: (
        customMaterialExtensions: MaterialExtension[],
    ) => void;
    userData: IMaterialUserData;
    wireframe?: boolean;
    dispose(force?: boolean): void;
    fromJSON(
        json: any,
        meta?: SerializationMetaType,
        _internal?: boolean,
    ): null | IMaterial<E, ET>;
    setDirty(options?: IMaterialSetDirtyOptions): void;
    setValues(
        parameters: Material | MaterialParameters & { type?: string },
        allowInvalidType?: boolean,
        clearCurrentUserData?: boolean,
    ): this;
    toJSON(meta?: SerializationMetaType, _internal?: boolean): any;
}

Type Parameters

Hierarchy

Implemented by

Properties

__matExtUiConfigs?: Record<string, undefined | UiObjectConfig>
alphaMap?: null | ITexture
aoMap?: null | ITexture
aoMapIntensity?: number
appliedMeshes: Set<IObject3D>

Managed internally, do not change manually

assetType: "material"
bumpMap?: null | ITexture
color?: Color
constructor: {
    MaterialProperties?: Record<string, any>;
    MaterialTemplate?: IMaterialTemplate;
    TYPE: string;
    TypeSlug: string;
}

The initial value of Object.prototype.constructor is the standard built-in Object constructor.

displacementMap?: null | ITexture
envMap?: null | ITexture
envMapIntensity?: number
extraUniformsToUpload: Record<string, IUniform>
flatShading?: boolean

Managed internally, do not change manually

isGBufferMaterial?: boolean
isPhysicalMaterial?: boolean
isRawShaderMaterial?: boolean
isUnlitMaterial?: boolean
lastShader?: Shader
lightMap?: null | ITexture
lightMapIntensity?: number
linewidth?: number
map?: null | ITexture
materialExtensions: MaterialExtension[]
metalness?: number
metalnessMap?: null | ITexture
needsUpdate: boolean

Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. This property is automatically set to true when instancing a new material.

false
normalMap?: null | ITexture
registerMaterialExtensions: (
    customMaterialExtensions: MaterialExtension[],
) => void
roughness?: number
roughnessMap?: null | ITexture
transmission?: number
transmissionMap?: null | ITexture
unregisterMaterialExtensions: (
    customMaterialExtensions: MaterialExtension[],
) => void

An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.

{}
wireframe?: boolean

Methods

  • Disposes the material from the GPU. Set force to false if not sure the material is used by any object in the scene. // todo add check for visible in scene also? or is that overkill

    Parameters

    • Optionalforce: boolean

      when true, same as three.js dispose. when false, only disposes if disposeOnIdle not false and not used by any object in the scene. default: true

    Returns void

  • Sets the properties based on the values.

    Parameters

    • parameters: Material | MaterialParameters & { type?: string }
    • OptionalallowInvalidType: boolean
    • OptionalclearCurrentUserData: boolean

    Returns this