A loader plugin of GLTFLoader for the extension VRMC_materials_mtoon.

This plugin is for uses with WebGLRenderer by default. To use MToon in WebGPURenderer, set materialType to MToonNodeMaterial.

import { MToonMaterialLoaderPlugin } from '@pixiv/three-vrm-materials-mtoon';
import { MToonNodeMaterial } from '@pixiv/three-vrm-materials-mtoon/nodes';

// ...

// Register a MToonMaterialLoaderPlugin with MToonNodeMaterial
loader.register((parser) => {

// create a WebGPU compatible MToonMaterialLoaderPlugin
return new MToonMaterialLoaderPlugin(parser, {

// set the material type to MToonNodeMaterial
materialType: MToonNodeMaterial,

});

});

Implements

  • GLTFLoaderPlugin

Constructors

Properties

Debug mode for the material. You can visualize several components for diagnosis using debug mode.

See: MToonMaterialDebugMode

'none'
materialType: typeof Material

The type of the material that this plugin will generate.

If you are using this plugin with WebGPU, set this to MToonNodeMaterial.

MToonMaterial
parser: GLTFParser
renderOrderOffset: number

This value will be added to renderOrder of every meshes who have MaterialsMToon. The final renderOrder will be sum of this renderOrderOffset and renderQueueOffsetNumber for each materials.

0
v0CompatShade: boolean

There is a line of the shader called "comment out if you want to PBR absolutely" in VRM0.0 MToon. When this is true, the material enables the line to make it compatible with the legacy rendering of VRM. Usually not recommended to turn this on.

false
EXTENSION_NAME: string

Accessors

  • get name(): string

    Returns string

Methods

  • Parameters

    • materialIndex: number

    Returns undefined | VRMCMaterialsMToon

  • Parameters

    • gltf: GLTF

    Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    Returns null | Promise<any>

  • Parameters

    • materialIndex: number

    Returns null | typeof Material

  • Parameters

    • meshIndex: number

    Returns Promise<
        | Group<Object3DEventMap>
        | Mesh<
            BufferGeometry<NormalBufferAttributes>,
            Material | Material[],
            Object3DEventMap,
        >
        | SkinnedMesh<
            BufferGeometry<NormalBufferAttributes>,
            Material | Material[],
            Object3DEventMap,
        >,
    >