Skip to content

Documentation / scene / MToonMaterial

Class: MToonMaterial ​

Defined in: libs/scene/src/material/mtoon.ts:48

MToonMaterial is a material that implements the MToon shader, which is a stylized shader commonly used for rendering anime-style characters. It supports features such as rim lighting, matcap, and outline rendering.

Extends ​

  • ToonMaterialBase

Constructors ​

Constructor ​

new MToonMaterial(): MToonMaterial

Defined in: libs/scene/src/material/mtoon.ts:70

Returns ​

MToonMaterial

Overrides ​

ToonMaterialBase.constructor

Properties ​

albedoTexture ​

albedoTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.albedoTexture


albedoTextureSampler ​

albedoTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.albedoTextureSampler


albedoTexCoordIndex ​

albedoTexCoordIndex: number

Inherited from ​

ToonMaterialBase.albedoTexCoordIndex


albedoTexCoordMatrix ​

albedoTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.albedoTexCoordMatrix


getAlbedoTextureUniform ​

getAlbedoTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getAlbedoTextureUniform


getAlbedoTexCoord ​

getAlbedoTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getAlbedoTexCoord


sampleAlbedoTexture ​

sampleAlbedoTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleAlbedoTexture


normalTexture ​

normalTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.normalTexture


normalTextureSampler ​

normalTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.normalTextureSampler


normalTexCoordIndex ​

normalTexCoordIndex: number

Inherited from ​

ToonMaterialBase.normalTexCoordIndex


normalTexCoordMatrix ​

normalTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.normalTexCoordMatrix


getNormalTextureUniform ​

getNormalTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getNormalTextureUniform


getNormalTexCoord ​

getNormalTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getNormalTexCoord


sampleNormalTexture ​

sampleNormalTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleNormalTexture


shadeMultiplyTexture ​

shadeMultiplyTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.shadeMultiplyTexture


shadeMultiplyTextureSampler ​

shadeMultiplyTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.shadeMultiplyTextureSampler


shadeMultiplyTexCoordIndex ​

shadeMultiplyTexCoordIndex: number

Inherited from ​

ToonMaterialBase.shadeMultiplyTexCoordIndex


shadeMultiplyTexCoordMatrix ​

shadeMultiplyTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.shadeMultiplyTexCoordMatrix


getShadeMultiplyTextureUniform ​

getShadeMultiplyTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getShadeMultiplyTextureUniform


getShadeMultiplyTexCoord ​

getShadeMultiplyTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getShadeMultiplyTexCoord


sampleShadeMultiplyTexture ​

sampleShadeMultiplyTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleShadeMultiplyTexture


shadingShiftTexture ​

shadingShiftTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.shadingShiftTexture


shadingShiftTextureSampler ​

shadingShiftTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.shadingShiftTextureSampler


shadingShiftTexCoordIndex ​

shadingShiftTexCoordIndex: number

Inherited from ​

ToonMaterialBase.shadingShiftTexCoordIndex


shadingShiftTexCoordMatrix ​

shadingShiftTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.shadingShiftTexCoordMatrix


getShadingShiftTextureUniform ​

getShadingShiftTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getShadingShiftTextureUniform


getShadingShiftTexCoord ​

getShadingShiftTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getShadingShiftTexCoord


sampleShadingShiftTexture ​

sampleShadingShiftTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleShadingShiftTexture


matcapTexture ​

matcapTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.matcapTexture


matcapTextureSampler ​

matcapTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.matcapTextureSampler


matcapTexCoordIndex ​

matcapTexCoordIndex: number

Inherited from ​

ToonMaterialBase.matcapTexCoordIndex


matcapTexCoordMatrix ​

matcapTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.matcapTexCoordMatrix


getMatcapTextureUniform ​

getMatcapTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getMatcapTextureUniform


getMatcapTexCoord ​

getMatcapTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getMatcapTexCoord


sampleMatcapTexture ​

sampleMatcapTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleMatcapTexture


rimMultiplyTexture ​

rimMultiplyTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.rimMultiplyTexture


rimMultiplyTextureSampler ​

rimMultiplyTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.rimMultiplyTextureSampler


rimMultiplyTexCoordIndex ​

rimMultiplyTexCoordIndex: number

Inherited from ​

ToonMaterialBase.rimMultiplyTexCoordIndex


rimMultiplyTexCoordMatrix ​

rimMultiplyTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.rimMultiplyTexCoordMatrix


getRimMultiplyTextureUniform ​

getRimMultiplyTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getRimMultiplyTextureUniform


getRimMultiplyTexCoord ​

getRimMultiplyTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getRimMultiplyTexCoord


sampleRimMultiplyTexture ​

sampleRimMultiplyTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleRimMultiplyTexture


outlineWidthMultiplyTexture ​

outlineWidthMultiplyTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.outlineWidthMultiplyTexture


outlineWidthMultiplyTextureSampler ​

outlineWidthMultiplyTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.outlineWidthMultiplyTextureSampler


outlineWidthMultiplyTexCoordIndex ​

outlineWidthMultiplyTexCoordIndex: number

Inherited from ​

ToonMaterialBase.outlineWidthMultiplyTexCoordIndex


outlineWidthMultiplyTexCoordMatrix ​

outlineWidthMultiplyTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.outlineWidthMultiplyTexCoordMatrix


getOutlineWidthMultiplyTextureUniform ​

getOutlineWidthMultiplyTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getOutlineWidthMultiplyTextureUniform


getOutlineWidthMultiplyTexCoord ​

getOutlineWidthMultiplyTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getOutlineWidthMultiplyTexCoord


sampleOutlineWidthMultiplyTexture ​

sampleOutlineWidthMultiplyTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleOutlineWidthMultiplyTexture


uvAnimationMaskTexture ​

uvAnimationMaskTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.uvAnimationMaskTexture


uvAnimationMaskTextureSampler ​

uvAnimationMaskTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.uvAnimationMaskTextureSampler


uvAnimationMaskTexCoordIndex ​

uvAnimationMaskTexCoordIndex: number

Inherited from ​

ToonMaterialBase.uvAnimationMaskTexCoordIndex


uvAnimationMaskTexCoordMatrix ​

uvAnimationMaskTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.uvAnimationMaskTexCoordMatrix


getUvAnimationMaskTextureUniform ​

getUvAnimationMaskTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getUvAnimationMaskTextureUniform


getUvAnimationMaskTexCoord ​

getUvAnimationMaskTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getUvAnimationMaskTexCoord


sampleUvAnimationMaskTexture ​

sampleUvAnimationMaskTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleUvAnimationMaskTexture


emissiveTexture ​

emissiveTexture: Texture2D<unknown>

Inherited from ​

ToonMaterialBase.emissiveTexture


emissiveTextureSampler ​

emissiveTextureSampler: TextureSampler<unknown>

Inherited from ​

ToonMaterialBase.emissiveTextureSampler


emissiveTexCoordIndex ​

emissiveTexCoordIndex: number

Inherited from ​

ToonMaterialBase.emissiveTexCoordIndex


emissiveTexCoordMatrix ​

emissiveTexCoordMatrix: Matrix4x4

Inherited from ​

ToonMaterialBase.emissiveTexCoordMatrix


getEmissiveTextureUniform ​

getEmissiveTextureUniform: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getEmissiveTextureUniform


getEmissiveTexCoord ​

getEmissiveTexCoord: (scope) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getEmissiveTexCoord


sampleEmissiveTexture ​

sampleEmissiveTexture: (scope, texCoord?) => PBShaderExp

Parameters ​

scope ​

PBInsideFunctionScope

texCoord? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.sampleEmissiveTexture


albedoColor ​

albedoColor: Vector4

Defined in: libs/scene/src/material/mixins/albedocolor.ts:16

Inherited from ​

ToonMaterialBase.albedoColor


normalScale ​

normalScale: number

Defined in: libs/scene/src/material/mixins/lit.ts:23

Inherited from ​

ToonMaterialBase.normalScale


normalMapMode ​

normalMapMode: "tangent-space" | "object-space"

Defined in: libs/scene/src/material/mixins/lit.ts:24

Inherited from ​

ToonMaterialBase.normalMapMode


doubleSidedLighting ​

doubleSidedLighting: boolean

Defined in: libs/scene/src/material/mixins/lit.ts:25

Inherited from ​

ToonMaterialBase.doubleSidedLighting

Accessors ​

disposed ​

Get Signature ​

get disposed(): boolean

Defined in: libs/base/dist/index.d.ts:6065

Returns ​

boolean

Inherited from ​

ToonMaterialBase.disposed


changeTag ​

Get Signature ​

get changeTag(): number

Defined in: libs/scene/src/material/material.ts:164

Incremented when the material’s GPU-relevant state changes and render bundles may need to be rebuilt.

Returns ​

number

Inherited from ​

ToonMaterialBase.changeTag


instanceId ​

Get Signature ​

get instanceId(): number

Defined in: libs/scene/src/material/material.ts:170

Runtime-unique numeric identifier for the material instance.

Returns ​

number

Inherited from ​

ToonMaterialBase.instanceId


numPasses ​

Get Signature ​

get numPasses(): number

Defined in: libs/scene/src/material/material.ts:180

Number of rendering passes this material uses.

Increasing this will expand the per-pass hash cache; make sure to implement createHash(pass), _createProgram(pb, ctx, pass), and updateRenderStates(pass, ...) accordingly for each pass.

Returns ​

number

Set Signature ​

set numPasses(val): void

Defined in: libs/scene/src/material/material.ts:183

Parameters ​
val ​

number

Returns ​

void

Inherited from ​

ToonMaterialBase.numPasses


coreMaterial ​

Get Signature ​

get coreMaterial(): this

Defined in: libs/scene/src/material/material.ts:264

Returns the core material that owns GPU state.

Instances may delegate to a shared core to reuse compiled programs and caches.

Returns ​

this

Inherited from ​

ToonMaterialBase.coreMaterial


drawContext ​

Get Signature ​

get drawContext(): DrawContext

Defined in: libs/scene/src/material/meshmaterial.ts:508

Draw context captured during program creation, available inside shader hooks.

Returns ​

DrawContext

The last DrawContext used to build or apply this material.

Inherited from ​

ToonMaterialBase.drawContext


pass ​

Get Signature ​

get pass(): number

Defined in: libs/scene/src/material/meshmaterial.ts:517

Current material pass index during program building. Typically used inside shader hooks to select per-pass logic.

Returns ​

number

The active pass index while building the program, or -1 when idle.

Inherited from ​

ToonMaterialBase.pass


alphaCutoff ​

Get Signature ​

get alphaCutoff(): number

Defined in: libs/scene/src/material/meshmaterial.ts:526

Alpha test cutoff in [0, 1].

  • 0 disables alpha testing.
  • > 0 discards fragments with alpha < cutoff. Changing this marks uniforms dirty (no shader rebuild).
Returns ​

number

Set Signature ​

set alphaCutoff(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:529

Parameters ​
val ​

number

Returns ​

void

Inherited from ​

ToonMaterialBase.alphaCutoff


alphaDither ​

Get Signature ​

get alphaDither(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:541

Whether alpha clipping uses frame-varying dither coverage.

  • Effective only when alpha cutoff is enabled.
  • Intended for masked materials (blendMode='none') to emulate soft transparency with TAA.
Returns ​

boolean

Set Signature ​

set alphaDither(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:544

Parameters ​
val ​

boolean

Returns ​

void

Inherited from ​

ToonMaterialBase.alphaDither


TAADisabled ​

Get Signature ​

get TAADisabled(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:555

Whether TAA is disabled for this material.

  • When true, motion vectors encode a large sentinel to skip TAA accumulation.
  • Managed via an internal feature toggle.
Returns ​

boolean

Set Signature ​

set TAADisabled(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:558

Parameters ​
val ​

boolean

Returns ​

void

Inherited from ​

ToonMaterialBase.TAADisabled


TAAStrength ​

Get Signature ​

get TAAStrength(): number

Defined in: libs/scene/src/material/meshmaterial.ts:566

TAA strength in [0, 1].

  • Higher values generally imply stronger accumulation.
  • The value is mapped when writing motion-vector outputs during depth pass.
Returns ​

number

Set Signature ​

set TAAStrength(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:569

Parameters ​
val ​

number

Returns ​

void

Inherited from ​

ToonMaterialBase.TAAStrength


alphaToCoverage ​

Get Signature ​

get alphaToCoverage(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:581

Alpha-to-coverage toggle.

  • Useful to approximate transparency for MSAA targets.
  • Managed as a shader feature; toggling rebuilds variants.
Returns ​

boolean

Set Signature ​

set alphaToCoverage(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:584

Parameters ​
val ​

boolean

Returns ​

void

Inherited from ​

ToonMaterialBase.alphaToCoverage


blendMode ​

Get Signature ​

get blendMode(): BlendMode

Defined in: libs/scene/src/material/meshmaterial.ts:592

Blending mode of this material.

  • 'none' for opaque, 'blend' for standard alpha, 'additive' for emissive FX.
  • Changing the mode toggles an internal feature and rebuilds variants.
Returns ​

BlendMode

Set Signature ​

set blendMode(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:595

Parameters ​
val ​

BlendMode

Returns ​

void

Inherited from ​

ToonMaterialBase.blendMode


transparentShadowCaster ​

Get Signature ​

get transparentShadowCaster(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:606

Whether transparent visible materials cast shadow through a masked shadow-only path.

  • Visible rendering stays blended.
  • Shadow-map rendering is treated like a cutout material using shadowAlphaCutoff.
Returns ​

boolean

Set Signature ​

set transparentShadowCaster(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:609

Parameters ​
val ​

boolean

Returns ​

void

Inherited from ​

ToonMaterialBase.transparentShadowCaster


shadowAlphaCutoff ​

Get Signature ​

get shadowAlphaCutoff(): number

Defined in: libs/scene/src/material/meshmaterial.ts:618

Alpha cutoff used by the shadow-only masked caster path.

Returns ​

number

Set Signature ​

set shadowAlphaCutoff(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:621

Parameters ​
val ​

number

Returns ​

void

Inherited from ​

ToonMaterialBase.shadowAlphaCutoff


cullMode ​

Get Signature ​

get cullMode(): FaceMode

Defined in: libs/scene/src/material/meshmaterial.ts:632

Face culling mode: 'none' | 'front' | 'back'.

  • Does not force shader rebuild; affects rasterizer state.
Returns ​

FaceMode

Set Signature ​

set cullMode(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:635

Parameters ​
val ​

FaceMode

Returns ​

void

Inherited from ​

ToonMaterialBase.cullMode


opacity ​

Get Signature ​

get opacity(): number

Defined in: libs/scene/src/material/meshmaterial.ts:645

Material opacity in [0, 1].

  • Used in transparent passes. Changing marks uniforms dirty only.
Returns ​

number

Set Signature ​

set opacity(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:648

Parameters ​
val ​

number

Returns ​

void

Inherited from ​

ToonMaterialBase.opacity


objectColor ​

Get Signature ​

get objectColor(): Immutable<Vector4>

Defined in: libs/scene/src/material/meshmaterial.ts:659

Per-object color used for GPU picking/object-ID pass.

  • Changing marks uniforms dirty only.
Returns ​

Immutable<Vector4>

Set Signature ​

set objectColor(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:662

Parameters ​
val ​

Immutable<Vector4>

Returns ​

void

Inherited from ​

ToonMaterialBase.objectColor


shadeColorFactor ​

Get Signature ​

get shadeColorFactor(): Immutable<Vector3>

Defined in: libs/scene/src/material/mtoon.ts:94

Returns ​

Immutable<Vector3>

Set Signature ​

set shadeColorFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:97

Parameters ​
val ​

Immutable<Vector3>

Returns ​

void


shadingShiftFactor ​

Get Signature ​

get shadingShiftFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:101

Returns ​

number

Set Signature ​

set shadingShiftFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:104

Parameters ​
val ​

number

Returns ​

void


shadingShiftTextureScale ​

Get Signature ​

get shadingShiftTextureScale(): number

Defined in: libs/scene/src/material/mtoon.ts:110

Returns ​

number

Set Signature ​

set shadingShiftTextureScale(val): void

Defined in: libs/scene/src/material/mtoon.ts:113

Parameters ​
val ​

number

Returns ​

void


shadingToonyFactor ​

Get Signature ​

get shadingToonyFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:119

Returns ​

number

Set Signature ​

set shadingToonyFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:122

Parameters ​
val ​

number

Returns ​

void


giEqualizationFactor ​

Get Signature ​

get giEqualizationFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:129

Returns ​

number

Set Signature ​

set giEqualizationFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:132

Parameters ​
val ​

number

Returns ​

void


matcapFactor ​

Get Signature ​

get matcapFactor(): Immutable<Vector3>

Defined in: libs/scene/src/material/mtoon.ts:139

Returns ​

Immutable<Vector3>

Set Signature ​

set matcapFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:142

Parameters ​
val ​

Immutable<Vector3>

Returns ​

void


parametricRimColorFactor ​

Get Signature ​

get parametricRimColorFactor(): Immutable<Vector3>

Defined in: libs/scene/src/material/mtoon.ts:146

Returns ​

Immutable<Vector3>

Set Signature ​

set parametricRimColorFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:149

Parameters ​
val ​

Immutable<Vector3>

Returns ​

void


parametricRimFresnelPowerFactor ​

Get Signature ​

get parametricRimFresnelPowerFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:153

Returns ​

number

Set Signature ​

set parametricRimFresnelPowerFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:156

Parameters ​
val ​

number

Returns ​

void


parametricRimLiftFactor ​

Get Signature ​

get parametricRimLiftFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:162

Returns ​

number

Set Signature ​

set parametricRimLiftFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:165

Parameters ​
val ​

number

Returns ​

void


rimLightingMixFactor ​

Get Signature ​

get rimLightingMixFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:171

Returns ​

number

Set Signature ​

set rimLightingMixFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:174

Parameters ​
val ​

number

Returns ​

void


outlineWidthMode ​

Get Signature ​

get outlineWidthMode(): MToonOutlineWidthMode

Defined in: libs/scene/src/material/mtoon.ts:181

Returns ​

MToonOutlineWidthMode

Set Signature ​

set outlineWidthMode(val): void

Defined in: libs/scene/src/material/mtoon.ts:184

Parameters ​
val ​

MToonOutlineWidthMode

Returns ​

void


outlineWidthFactor ​

Get Signature ​

get outlineWidthFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:191

Returns ​

number

Set Signature ​

set outlineWidthFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:194

Parameters ​
val ​

number

Returns ​

void


outlineColorFactor ​

Get Signature ​

get outlineColorFactor(): Immutable<Vector3>

Defined in: libs/scene/src/material/mtoon.ts:201

Returns ​

Immutable<Vector3>

Set Signature ​

set outlineColorFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:204

Parameters ​
val ​

Immutable<Vector3>

Returns ​

void


outlineLightingMixFactor ​

Get Signature ​

get outlineLightingMixFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:208

Returns ​

number

Set Signature ​

set outlineLightingMixFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:211

Parameters ​
val ​

number

Returns ​

void


outlineUsesTangentNormals ​

Get Signature ​

get outlineUsesTangentNormals(): boolean

Defined in: libs/scene/src/material/mtoon.ts:218

Returns ​

boolean

Set Signature ​

set outlineUsesTangentNormals(val): void

Defined in: libs/scene/src/material/mtoon.ts:221

Parameters ​
val ​

boolean

Returns ​

void


transparentWithZWrite ​

Get Signature ​

get transparentWithZWrite(): boolean

Defined in: libs/scene/src/material/mtoon.ts:224

Returns ​

boolean

Set Signature ​

set transparentWithZWrite(val): void

Defined in: libs/scene/src/material/mtoon.ts:227

Parameters ​
val ​

boolean

Returns ​

void


renderQueueOffsetNumber ​

Get Signature ​

get renderQueueOffsetNumber(): number

Defined in: libs/scene/src/material/mtoon.ts:233

Returns ​

number

Set Signature ​

set renderQueueOffsetNumber(val): void

Defined in: libs/scene/src/material/mtoon.ts:236

Parameters ​
val ​

number

Returns ​

void


uvAnimationScrollXSpeedFactor ​

Get Signature ​

get uvAnimationScrollXSpeedFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:243

Returns ​

number

Set Signature ​

set uvAnimationScrollXSpeedFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:246

Parameters ​
val ​

number

Returns ​

void


uvAnimationScrollYSpeedFactor ​

Get Signature ​

get uvAnimationScrollYSpeedFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:252

Returns ​

number

Set Signature ​

set uvAnimationScrollYSpeedFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:255

Parameters ​
val ​

number

Returns ​

void


uvAnimationRotationSpeedFactor ​

Get Signature ​

get uvAnimationRotationSpeedFactor(): number

Defined in: libs/scene/src/material/mtoon.ts:261

Returns ​

number

Set Signature ​

set uvAnimationRotationSpeedFactor(val): void

Defined in: libs/scene/src/material/mtoon.ts:264

Parameters ​
val ​

number

Returns ​

void


emissiveColor ​

Get Signature ​

get emissiveColor(): Immutable<Vector3>

Defined in: libs/scene/src/material/mtoon.ts:270

Returns ​

Immutable<Vector3>

Set Signature ​

set emissiveColor(val): void

Defined in: libs/scene/src/material/mtoon.ts:273

Parameters ​
val ​

Immutable<Vector3>

Returns ​

void


emissiveStrength ​

Get Signature ​

get emissiveStrength(): number

Defined in: libs/scene/src/material/mtoon.ts:277

Returns ​

number

Set Signature ​

set emissiveStrength(val): void

Defined in: libs/scene/src/material/mtoon.ts:280

Parameters ​
val ​

number

Returns ​

void

Methods ​

on() ​

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:594

IEventTarget.on

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener ​

EventListener<{ dispose: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

ToonMaterialBase.on


once() ​

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:598

IEventTarget.once

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener ​

EventListener<{ dispose: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

ToonMaterialBase.once


off() ​

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:602

IEventTarget.off

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

listener? ​

EventListener<{ dispose: []; }>

context? ​

unknown

Returns ​

void

Inherited from ​

ToonMaterialBase.off


dispatchEvent() ​

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:606

IEventTarget.dispatchEvent

Type Parameters ​

K ​

K extends "dispose"

Parameters ​

type ​

K

args ​

...object[K]

Returns ​

void

Inherited from ​

ToonMaterialBase.dispatchEvent


dispose() ​

dispose(): void

Defined in: libs/base/dist/index.d.ts:6066

Returns ​

void

Inherited from ​

ToonMaterialBase.dispose


supportInstancing() ​

supportInstancing(): boolean

Defined in: libs/scene/src/material/material.ts:230

Whether this material supports hardware instancing.

Override and return false if per-instance data is not supported in the shader.

Returns ​

boolean

Inherited from ​

ToonMaterialBase.supportInstancing


isBatchable() ​

isBatchable(): boolean

Defined in: libs/scene/src/material/material.ts:234

Returns true if this is a instance of material

Returns ​

boolean

Inherited from ​

ToonMaterialBase.isBatchable


needSceneColor() ​

needSceneColor(): boolean

Defined in: libs/scene/src/material/material.ts:241

Whether this material requires the scene color texture (e.g., for refraction).

Returns ​

boolean

Inherited from ​

ToonMaterialBase.needSceneColor


needSceneDepth() ​

needSceneDepth(): boolean

Defined in: libs/scene/src/material/material.ts:247

Whether this material requires the linear scene depth texture (e.g., for depth-aware effects).

Returns ​

boolean

Inherited from ​

ToonMaterialBase.needSceneDepth


applyUniforms() ​

applyUniforms(bindGroup, ctx, needUpdate, pass): void

Defined in: libs/scene/src/material/material.ts:415

Conditionally update uniforms/resources into the material bind group.

Delegates to _applyUniforms() when needUpdate is true (based on _optionTag check).

Parameters ​

bindGroup ​

BindGroup

Material bind group at index 2 (may be null if program has no layout).

ctx ​

DrawContext

Draw context.

needUpdate ​

boolean

Whether uniforms need to be refreshed.

pass ​

number

Pass index.

Returns ​

void

Inherited from ​

ToonMaterialBase.applyUniforms


clearCache() ​

clearCache(): void

Defined in: libs/scene/src/material/material.ts:440

Returns ​

void

Inherited from ​

ToonMaterialBase.clearCache


onDispose() ​

protected onDispose(): void

Defined in: libs/scene/src/material/material.ts:499

Dispose the material and release GPU-side resource references.

  • Unregisters from the global registry.
  • Disposes the per-material bind groups kept in _states.

Returns ​

void

Inherited from ​

ToonMaterialBase.onDispose


apply() ​

apply(ctx): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:241

Capture the active draw context for both cached and freshly-built program paths.

The shader-building hooks access this.drawContext, but uniform application may also consult it on subsequent frames when the GPU program is reused from cache. Updating it here keeps material mixins in sync even when createProgram() is skipped.

Parameters ​

ctx ​

DrawContext

Current draw context.

Returns ​

boolean

Whether material preparation succeeded.

Inherited from ​

ToonMaterialBase.apply


uniformChanged() ​

uniformChanged(): void

Defined in: libs/scene/src/material/meshmaterial.ts:250

Mark uniform-only changes so uniforms are re-uploaded on next apply, without rebuilding shader programs.

Returns ​

void

Inherited from ​

ToonMaterialBase.uniformChanged


defineFeature() ​

static defineFeature(): number

Defined in: libs/scene/src/material/meshmaterial.ts:257

Define a new feature bit/index for shader variants. Subclasses may use this to add their own switches.

Returns ​

number

Inherited from ​

ToonMaterialBase.defineFeature


defineInstanceUniform() ​

static defineInstanceUniform(prop, type, name?): number

Defined in: libs/scene/src/material/meshmaterial.ts:290

Define a per-instance uniform for this class.

Returns a compact index encoding the vector index and component offset, which can be used in shader code via getInstancedUniform(...).

Parameters ​

prop ​

string

Property name exposed on instances.

type ​

InstanceUniformType

Uniform data type.

name? ​

string = ''

Returns ​

number

Encoded index for use in getInstancedUniform.

Throws ​

If the property is already defined or type is invalid.

Inherited from ​

ToonMaterialBase.defineInstanceUniform


getInstancedUniform() ​

getInstancedUniform(scope, uniformIndex): PBShaderExp

Defined in: libs/scene/src/material/meshmaterial.ts:331

Read an encoded per-instance uniform in shader code.

Encoded index packs: vector index, component offset, and component count.

Parameters ​

scope ​

PBInsideFunctionScope

Inside-function shader scope.

uniformIndex ​

number

Encoded index from defineInstanceUniform.

Returns ​

PBShaderExp

The shader expression reading the selected components.

Inherited from ​

ToonMaterialBase.getInstancedUniform


getInstancedUniforms() ​

getInstancedUniforms(): object[]

Defined in: libs/scene/src/material/meshmaterial.ts:353

Get the list of per-instance uniforms for this material class.

Returns ​

object[]

Inherited from ​

ToonMaterialBase.getInstancedUniforms


createInstance() ​

createInstance(): this

Defined in: libs/scene/src/material/meshmaterial.ts:368

Create a material instance (preferred for GPU instancing).

  • On WebGL1 (or when instancing unsupported), falls back to cloning.
  • Otherwise, returns a proxy instance that shares GPU programs and stores per-instance uniforms in a compact Float32Array.

The returned instance:

  • Exposes properties defined by defineInstanceUniform with getter/setter that read/write the packed buffer and notify RenderBundleWrapper.
  • Delegates methods to the core material via prototype chain.

Returns ​

this

Inherited from ​

ToonMaterialBase.createInstance


supportLighting() ​

supportLighting(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:674

Whether this material responds to scene lighting. Override to return false for unlit materials.

Returns ​

boolean

True if lighting affects this material; otherwise false.

Inherited from ​

ToonMaterialBase.supportLighting


getEffectiveBlendMode() ​

protected getEffectiveBlendMode(pass, ctx?): BlendMode

Defined in: libs/scene/src/material/meshmaterial.ts:681

Returns the effective blend mode for the current pass. Transparent-shadow-caster materials stay blended in visible passes, but become masked in shadow passes.

Parameters ​

pass ​

number

ctx? ​

DrawContext

Returns ​

BlendMode

Inherited from ​

ToonMaterialBase.getEffectiveBlendMode


getActiveAlphaCutoff() ​

protected getActiveAlphaCutoff(ctx?, pass?): number

Defined in: libs/scene/src/material/meshmaterial.ts:694

Returns the alpha cutoff that should be used for the current pass.

Parameters ​

ctx? ​

DrawContext

pass? ​

number = ...

Returns ​

number

Inherited from ​

ToonMaterialBase.getActiveAlphaCutoff


useTransparentShadowCaster() ​

useTransparentShadowCaster(ctx?, _pass?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:700

Whether the current pass should use the shadow-only masked caster path.

Parameters ​

ctx? ​

DrawContext

_pass? ​

number = ...

Returns ​

boolean

Inherited from ​

ToonMaterialBase.useTransparentShadowCaster


useTransparentShadowCasterForPass() ​

useTransparentShadowCasterForPass(renderPassType?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:706

Whether the specified render pass type should reinterpret this transparent material as a masked shadow caster.

Parameters ​

renderPassType? ​

number

Returns ​

boolean

Inherited from ​

ToonMaterialBase.useTransparentShadowCasterForPass


usesAlphaCutoff() ​

protected usesAlphaCutoff(ctx?, pass?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:716

Whether this pass needs an alpha-cutoff uniform bound.

Parameters ​

ctx? ​

DrawContext

pass? ​

number = ...

Returns ​

boolean

Inherited from ​

ToonMaterialBase.usesAlphaCutoff


needFragmentColorInput() ​

needFragmentColorInput(ctx?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:724

Whether this pass needs fragment color inputs. This stays aligned with the historical meaning of needFragmentColor, but also allows shadow-only transparent casters to fetch alpha sources.

Parameters ​

ctx? ​

DrawContext

Returns ​

boolean

Inherited from ​

ToonMaterialBase.needFragmentColorInput


featureUsed() ​

featureUsed<T>(feature): T

Defined in: libs/scene/src/material/meshmaterial.ts:867

Query a feature flag’s current value.

Type Parameters ​

T ​

T = unknown

Expected value type.

Parameters ​

feature ​

number

The feature index.

Returns ​

T

The current value for the feature, typed as T.

Inherited from ​

ToonMaterialBase.featureUsed


useFeature() ​

useFeature(feature, use): void

Defined in: libs/scene/src/material/meshmaterial.ts:878

Enable or disable a feature and trigger variant rebuild when changed. Calls optionChanged(true) internally on change.

Parameters ​

feature ​

number

The feature index to set.

use ​

unknown

The new feature value (typed by convention).

Returns ​

void

void

Inherited from ​

ToonMaterialBase.useFeature


needFragmentColor() ​

needFragmentColor(ctx?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:917

Whether the fragment shader needs to compute color. Returns true for LIGHT pass, or when alpha test or alpha-to-coverage is enabled. Override if the material writes color in other passes.

Parameters ​

ctx? ​

DrawContext

Optional draw context; defaults to the last captured drawContext.

Returns ​

boolean

True if fragment color computation is needed; otherwise false.

Inherited from ​

ToonMaterialBase.needFragmentColor


outputFragmentColor() ​

outputFragmentColor(scope, worldPos, color, ssrRoughness?, ssrNormal?, sssProfile?, sssParams?, sssDiffuse?, sssTransmission?, sssProfileEnabled?, skinSSS?): void

Defined in: libs/scene/src/material/meshmaterial.ts:1069

Centralized final color write and per-pass output composition.

Behavior by pass:

  • LIGHT: clipping, alpha handling, optional OIT integration, fog application, color output encoding.
  • DEPTH: encoded depth; optional motion vectors (TAA enabled/disabled handling).
  • OBJECT_COLOR: object color and distance output (linear depth or world-pos + distance).
  • SHADOWMAP: writes shadow depth via light’s shadow implementation.

Also writes SSR roughness/normal buffers when requested via material flags.

Parameters ​

scope ​

PBInsideFunctionScope

Inside-function shader scope.

worldPos ​

PBShaderExp

Fragment world-space position expression.

color ​

PBShaderExp

Lit fragment color expression; may be undefined for depth-only paths.

ssrRoughness? ​

PBShaderExp

Optional SSR roughness output expression.

ssrNormal? ​

PBShaderExp

Optional SSR normal output expression.

sssProfile? ​

PBShaderExp

Optional SSS profile output expression.

sssParams? ​

PBShaderExp

Optional SSS packed params output expression.

sssDiffuse? ​

PBShaderExp

Optional diffuse-only lighting color for SSS composition.

sssTransmission? ​

PBShaderExp

Optional thin-shell transmission lighting color for SSS composition.

sssProfileEnabled? ​

boolean = false

True only when this material should write SSS profile data.

skinSSS? ​

PBShaderExp

Returns ​

void

void

Inherited from ​

ToonMaterialBase.outputFragmentColor


calculateAlbedoColor() ​

calculateAlbedoColor(scope, uv?): PBShaderExp

Defined in: libs/scene/src/material/mixins/albedocolor.ts:17

Parameters ​

scope ​

PBInsideFunctionScope

uv? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateAlbedoColor


lambertLight() ​

lambertLight(scope, worldPos, normal, albedo): PBShaderExp

Defined in: libs/scene/src/material/mixins/lightmodel/lambert.ts:13

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

normal ​

PBShaderExp

albedo ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.lambertLight


needCalculateEnvLight() ​

needCalculateEnvLight(): boolean

Defined in: libs/scene/src/material/mixins/lit.ts:26

Returns ​

boolean

Inherited from ​

ToonMaterialBase.needCalculateEnvLight


getUniformNormalScale() ​

getUniformNormalScale(scope): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:27

Parameters ​

scope ​

PBInsideFunctionScope

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getUniformNormalScale


getEnvLightIrradiance() ​

getEnvLightIrradiance(scope, normal): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:28

Parameters ​

scope ​

PBInsideFunctionScope

normal ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getEnvLightIrradiance


getEnvLightRadiance() ​

getEnvLightRadiance(scope, reflectVec, roughness): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:29

Parameters ​

scope ​

PBInsideFunctionScope

reflectVec ​

PBShaderExp

roughness ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.getEnvLightRadiance


calculateViewVector() ​

calculateViewVector(scope, worldPos): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:34

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateViewVector


calculateReflectionVector() ​

calculateReflectionVector(scope, normal, viewVec): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:35

Parameters ​

scope ​

PBInsideFunctionScope

normal ​

PBShaderExp

viewVec ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateReflectionVector


calculateTBN() ​

calculateTBN(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:40

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

worldNormal? ​

PBShaderExp

worldTangent? ​

PBShaderExp

worldBinormal? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateTBN


calculateNormal() ​

calculateNormal(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:47

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

worldNormal? ​

PBShaderExp

worldTangent? ​

PBShaderExp

worldBinormal? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateNormal


calculateNormalAndTBN() ​

calculateNormalAndTBN(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:54

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

worldNormal? ​

PBShaderExp

worldTangent? ​

PBShaderExp

worldBinormal? ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateNormalAndTBN


calculateLightAttenuation() ​

calculateLightAttenuation(scope, type, worldPos, posRange, dirCutoff): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:61

Parameters ​

scope ​

PBInsideFunctionScope

type ​

PBShaderExp

worldPos ​

PBShaderExp

posRange ​

PBShaderExp

dirCutoff ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateLightAttenuation


calculateLightDirection() ​

calculateLightDirection(scope, type, worldPos, posRange, dirCutoff): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:68

Parameters ​

scope ​

PBInsideFunctionScope

type ​

PBShaderExp

worldPos ​

PBShaderExp

posRange ​

PBShaderExp

dirCutoff ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateLightDirection


calculateShadow() ​

calculateShadow(scope, worldPos, NoL): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:75

Parameters ​

scope ​

PBInsideFunctionScope

worldPos ​

PBShaderExp

NoL ​

PBShaderExp

Returns ​

PBShaderExp

Inherited from ​

ToonMaterialBase.calculateShadow


forEachLight() ​

forEachLight(scope, callback): void

Defined in: libs/scene/src/material/mixins/lit.ts:76

Parameters ​

scope ​

PBInsideFunctionScope

callback ​

(this, type, posRange, dirCutoff, colorIntensity, extra, shadow) => void

Returns ​

void

Inherited from ​

ToonMaterialBase.forEachLight


clone() ​

clone(): MToonMaterial

Defined in: libs/scene/src/material/mtoon.ts:286

Create a shallow clone of this material. Subclasses should override to copy custom fields.

Returns ​

MToonMaterial

Overrides ​

ToonMaterialBase.clone


copyFrom() ​

copyFrom(other): void

Defined in: libs/scene/src/material/mtoon.ts:291

Copy common MeshMaterial properties from another material. Call super.copyFrom(other) first when overriding in subclasses.

Parameters ​

other ​

this

Source material.

Returns ​

void

Overrides ​

ToonMaterialBase.copyFrom


getQueueType() ​

getQueueType(): 1 | 2

Defined in: libs/scene/src/material/mtoon.ts:316

Determine the render queue for this material. Transparent materials are queued as QUEUE_TRANSPARENT, otherwise QUEUE_OPAQUE.

Returns ​

1 | 2

The queue type constant.

Overrides ​

ToonMaterialBase.getQueueType


passToHash() ​

passToHash(pass): string

Defined in: libs/scene/src/material/mtoon.ts:319

Convert a pass index to a hash seed string.

Subclasses may override to encode per-pass role (e.g., "depth", "forward", "shadow").

Parameters ​

pass ​

number

Pass number.

Returns ​

string

String used when building full hash.

Overrides ​

ToonMaterialBase.passToHash


isTransparentPass() ​

isTransparentPass(pass, ctx?): boolean

Defined in: libs/scene/src/material/mtoon.ts:322

Whether the given pass is transparent. Default returns true when blendMode !== 'none'.

Parameters ​

pass ​

number

Material pass index.

ctx? ​

DrawContext

Returns ​

boolean

True if the pass is transparent; otherwise false.

Overrides ​

ToonMaterialBase.isTransparentPass


updateRenderStates() ​

protected updateRenderStates(pass, stateSet, ctx): void

Defined in: libs/scene/src/material/mtoon.ts:325

Update render states per pass and draw context. Sets blending, alpha-to-coverage, depth test/write, cull mode, color mask, and cooperates with OIT.

Parameters ​

pass ​

number

Current material pass index.

stateSet ​

RenderStateSet

Render state set to update.

ctx ​

DrawContext

Current draw context.

Returns ​

void

void

Overrides ​

ToonMaterialBase.updateRenderStates


drawPrimitive() ​

drawPrimitive(pass, primitive, ctx, numInstances): void

Defined in: libs/scene/src/material/mtoon.ts:352

Issue the actual draw call for a pass.

Override for custom per-pass draw behavior if necessary. The default implementation:

  • Draws instanced if numInstances > 0.
  • Else uses ctx.instanceData.numInstances if available.
  • Else issues a non-instanced draw.

Parameters ​

pass ​

number

Pass number.

primitive ​

Primitive

Primitive to draw.

ctx ​

DrawContext

Draw context.

numInstances ​

number

Explicit instance count (0 = auto).

Returns ​

void

Overrides ​

ToonMaterialBase.drawPrimitive


applyUniformValues() ​

applyUniformValues(bindGroup, ctx, pass): void

Defined in: libs/scene/src/material/mtoon.ts:358

Submit material uniforms/resources to the material bind group (set 2). Handles alpha cutoff, opacity (non-instanced transparent), OIT, object color, and TAA strength.

Parameters ​

bindGroup ​

BindGroup

The material bind group to write into.

ctx ​

DrawContext

Current draw context.

pass ​

number

Current material pass index.

Returns ​

void

void

Overrides ​

ToonMaterialBase.applyUniformValues


vertexShader() ​

vertexShader(scope): void

Defined in: libs/scene/src/material/mtoon.ts:598

Vertex shader hook. Prepares common inputs (skin/morph/instancing), varyings, and pass-dependent outputs. Override to implement per-vertex logic; use ShaderHelper as needed.

Parameters ​

scope ​

PBFunctionScope

Vertex shader function scope.

Returns ​

void

void

Overrides ​

ToonMaterialBase.vertexShader


fragmentShader() ​

fragmentShader(scope): void

Defined in: libs/scene/src/material/mtoon.ts:703

Fragment shader hook. Declares pass-dependent uniforms (e.g., opacity, objectColor, alphaCutoff). Override to implement per-fragment logic, and call outputFragmentColor to finalize writes.

Parameters ​

scope ​

PBFunctionScope

Fragment shader function scope.

Returns ​

void

void

Overrides ​

ToonMaterialBase.fragmentShader

Released under the MIT License.