Skip to content

EffectMaterial

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:104

Base material class with composable packed-buffer effect system.

Extends MeshBasicNodeMaterial and adds:

  • Packed vec4 effect buffers with bitmask enable flags
  • Effect registration with automatic slot assignment
  • Shader rebuilding with effect chain composition

Subclasses override _buildBaseColor() to provide their own base color/UV (e.g., Sprite2DMaterial provides sprite-specific UV flip, atlas, tint).

This base class can be extended for non-sprite materials that also need effects.

new EffectMaterial(options?): EffectMaterial

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:229

EffectMaterialOptions = {}

EffectMaterial

MeshBasicNodeMaterial.constructor

allowOverride: boolean

Defined in: three.js/materials/Material:allowOverride 

Whether it’s possible to override the material with Scene#overrideMaterial  or not.

true

MeshBasicNodeMaterial.allowOverride


alphaHash: boolean

Defined in: three.js/materials/Material:alphaHash 

Enables alpha hashed transparency, an alternative to Material#transparent or Material#alphaTest. The material will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise, but approximates alpha blending without the associated problems of sorting. Using TAA can reduce the resulting noise.

false

MeshBasicNodeMaterial.alphaHash


alphaMap: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:alphaMap 

The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque).

Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.

alphaMap represents non-color data. Any texture assigned must have texture.colorSpace = NoColorSpace (default).

null

MeshBasicNodeMaterial.alphaMap


alphaTestNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:alphaTestNode 

The alpha test of node materials is by default inferred from the alphaTest property. This node property allows to overwrite the default and define the alpha test with a node instead.

If you don’t want to overwrite the alpha test but modify the existing value instead, use materialAlphaTest.

null

MeshBasicNodeMaterial.alphaTestNode


alphaToCoverage: boolean

Defined in: three.js/materials/Material:alphaToCoverage 

Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with antialias parameter set to true). Enabling this will smooth aliasing on clip plane edges and alphaTest-clipped edges.

false

MeshBasicNodeMaterial.alphaToCoverage


aoMap: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:aoMap 

The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs.

aoMap represents non-color data. Any texture assigned must have texture.colorSpace = NoColorSpace (default).

null

MeshBasicNodeMaterial.aoMap


aoMapIntensity: number

Defined in: three.js/materials/MeshBasicMaterial:aoMapIntensity 

Intensity of the ambient occlusion effect. Range is [0,1], where 0 disables ambient occlusion. Where intensity is 1 and the AO map’s red channel is also 1, ambient light is fully occluded on a surface.

1

MeshBasicNodeMaterial.aoMapIntensity


aoNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:aoNode 

The lighting of node materials might be influenced by ambient occlusion. The default AO is inferred from an ambient occlusion map assigned to aoMap and the respective aoMapIntensity. This node property allows to overwrite the default and define the ambient occlusion with a custom node instead.

If you don’t want to overwrite the diffuse color but modify the existing values instead, use materialAO.

null

MeshBasicNodeMaterial.aoNode


backdropAlphaNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:backdropAlphaNode 

This node allows to modulate the influence of backdropNode to the outgoing light.

null

MeshBasicNodeMaterial.backdropAlphaNode


backdropNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:backdropNode 

This node can be used to implement a variety of filter-like effects. The idea is to store the current rendering into a texture e.g. via viewportSharedTexture(), use it to create an arbitrary effect and then assign the node composition to this property. Everything behind the object using this material will now be affected by a filter.

const material = new NodeMaterial()
material.transparent = true;
// everything behind the object will be monochromatic
material.backdropNode = saturation( viewportSharedTexture().rgb, 0 );

Backdrop computations are part of the lighting so only lit materials can use this property.

null

MeshBasicNodeMaterial.backdropNode


blendAlpha: number

Defined in: three.js/materials/Material:blendAlpha 

Represents the alpha value of the constant blend color.

This property has only an effect when using custom blending with ConstantAlpha or OneMinusConstantAlpha.

0

MeshBasicNodeMaterial.blendAlpha


blendColor: Color 

Defined in: three.js/materials/Material:blendColor 

Represents the RGB values of the constant blend color.

This property has only an effect when using custom blending with ConstantColor or OneMinusConstantColor.

(0,0,0)

MeshBasicNodeMaterial.blendColor


blendDst: BlendingDstFactor 

Defined in: three.js/materials/Material:blendDst 

Defines the blending destination factor.

OneMinusSrcAlphaFactor

MeshBasicNodeMaterial.blendDst


blendDstAlpha: BlendingDstFactor  | null

Defined in: three.js/materials/Material:blendDstAlpha 

Defines the blending destination alpha factor.

null

MeshBasicNodeMaterial.blendDstAlpha


blendEquation: BlendingEquation 

Defined in: three.js/materials/Material:blendEquation 

Defines the blending equation.

AddEquation

MeshBasicNodeMaterial.blendEquation


blendEquationAlpha: BlendingEquation  | null

Defined in: three.js/materials/Material:blendEquationAlpha 

Defines the blending equation of the alpha channel.

null

MeshBasicNodeMaterial.blendEquationAlpha


blending: Blending 

Defined in: three.js/materials/Material:blending 

Defines the blending type of the material.

It must be set to CustomBlending if custom blending properties like Material#blendSrc, Material#blendDst or Material#blendEquation should have any effect.

NormalBlending

MeshBasicNodeMaterial.blending


blendSrc: BlendingSrcFactor 

Defined in: three.js/materials/Material:blendSrc 

Defines the blending source factor.

SrcAlphaFactor

MeshBasicNodeMaterial.blendSrc


blendSrcAlpha: BlendingSrcFactor  | null

Defined in: three.js/materials/Material:blendSrcAlpha 

Defines the blending source alpha factor.

null

MeshBasicNodeMaterial.blendSrcAlpha


castShadowNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:castShadowNode 

This node can be used to influence how an object using this node material casts shadows. To apply a color to shadows, you can simply do:

material.castShadowNode = vec4( 1, 0, 0, 1 );

Which can be nice to fake colored shadows of semi-transparent objects. It is also common to use the property with Fn function so checks are performed per fragment.

materialCustomShadow.castShadowNode = Fn( () => {
hash( vertexIndex ).greaterThan( 0.5 ).discard();
return materialColor;
} )();
null

MeshBasicNodeMaterial.castShadowNode


castShadowPositionNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:castShadowPositionNode 

Allows to overwrite the geometry position used for shadow map projection which is by default positionLocal, the vertex position in local space.

null

MeshBasicNodeMaterial.castShadowPositionNode


clipIntersection: boolean

Defined in: three.js/materials/Material:clipIntersection 

Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.

false

MeshBasicNodeMaterial.clipIntersection


clippingPlanes: Plane [] | null

Defined in: three.js/materials/Material:clippingPlanes 

User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires WebGLRenderer#localClippingEnabled  to be true.

null

MeshBasicNodeMaterial.clippingPlanes


clipShadows: boolean

Defined in: three.js/materials/Material:clipShadows 

Defines whether to clip shadows according to the clipping planes specified on this material.

false

MeshBasicNodeMaterial.clipShadows


color: Color 

Defined in: three.js/materials/MeshBasicMaterial:color 

Color of the material.

(1,1,1)

MeshBasicNodeMaterial.color


colorNode: Node <"vec3"> | Node <"float"> | Node <"vec4"> | Node <"vec2"> | Node <"color"> | null

Defined in: three.js/materials/nodes/NodeMaterial:colorNode 

The diffuse color of node materials is by default inferred from the color and map properties. This node property allows to overwrite the default and define the diffuse color with a node instead.

material.colorNode = color( 0xff0000 ); // define red color

If you don’t want to overwrite the diffuse color but modify the existing values instead, use materialColor.

material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint
null

MeshBasicNodeMaterial.colorNode


colorWrite: boolean

Defined in: three.js/materials/Material:colorWrite 

Whether to render the material’s color.

This can be used in conjunction with Object3D#renderOder to create invisible objects that occlude other objects.

true

MeshBasicNodeMaterial.colorWrite


combine: Combine 

Defined in: three.js/materials/MeshBasicMaterial:combine 

How to combine the result of the surface’s color with the environment map, if any.

When set to MixOperation, the MeshBasicMaterial#reflectivity is used to blend between the two colors.

MultiplyOperation

MeshBasicNodeMaterial.combine


contextNode: ContextNode <unknown> | null

Defined in: three.js/materials/nodes/NodeMaterial:contextNode 

This node can be used as a global context management component for this material.

null

MeshBasicNodeMaterial.contextNode


optional defines?: Record<string, unknown>

Defined in: three.js/materials/Material:defines 

MeshBasicNodeMaterial.defines


depthFunc: DepthModes 

Defined in: three.js/materials/Material:depthFunc 

Defines the depth function.

LessEqualDepth

MeshBasicNodeMaterial.depthFunc


depthNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:depthNode 

Allows to overwrite depth values in the fragment shader.

null

MeshBasicNodeMaterial.depthNode


depthTest: boolean

Defined in: three.js/materials/Material:depthTest 

Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write will also be implicitly disabled.

true

MeshBasicNodeMaterial.depthTest


depthWrite: boolean

Defined in: three.js/materials/Material:depthWrite 

Whether rendering this material has any effect on the depth buffer.

When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.

true

MeshBasicNodeMaterial.depthWrite


dithering: boolean

Defined in: three.js/materials/Material:dithering 

Whether to apply dithering to the color to remove the appearance of banding.

false

MeshBasicNodeMaterial.dithering


envMap: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:envMap 

The environment map.

envMap represents luminance data, and the texture must be assigned a Texture#colorSpace . Most envMap textures set texture.colorSpace = LinearSRGBColorSpace and use float-type formats such as .exr or .hdr.

null

MeshBasicNodeMaterial.envMap


envMapRotation: Euler 

Defined in: three.js/materials/MeshBasicMaterial:envMapRotation 

The rotation of the environment map in radians.

(0,0,0)

MeshBasicNodeMaterial.envMapRotation


envNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:envNode 

The environment of node materials can be defined by an environment map assigned to the envMap property or by Scene.environment if the node material is a PBR material. This node property allows to overwrite the default behavior and define the environment with a custom node.

material.envNode = pmremTexture( renderTarget.texture );
null

MeshBasicNodeMaterial.envNode


fog: boolean

Defined in: three.js/materials/nodes/NodeMaterial:fog 

Whether this material is affected by fog or not.

true

MeshBasicNodeMaterial.fog


forceSinglePass: boolean

Defined in: three.js/materials/Material:forceSinglePass 

Whether double-sided, transparent objects should be rendered with a single pass or not.

The engine renders double-sided, transparent objects with two draw calls (back faces first, then front faces) to mitigate transparency artifacts. There are scenarios however where this approach produces no quality gains but still doubles draw calls e.g. when rendering flat vegetation like grass sprites. In these cases, set the forceSinglePass flag to true to disable the two pass rendering to avoid performance issues.

false

MeshBasicNodeMaterial.forceSinglePass


fragmentNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:fragmentNode 

This node property can be used if you need complete freedom in implementing the fragment shader. Assigning a node will replace the built-in material logic used in the fragment stage.

null

MeshBasicNodeMaterial.fragmentNode


geometryNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:geometryNode 

This node property is intended for logic which modifies geometry data once or per animation step. Apps usually place such logic randomly in initialization routines or in the animation loop. geometryNode is intended as a dedicated API so there is an intended spot where geometry modifications can be implemented.

The idea is to assign a Fn definition that holds the geometry modification logic. A typical example would be a GPU based particle system that provides a node material for usage on app level. The particle simulation would be implemented as compute shaders and managed inside a Fn function. This function is eventually assigned to geometryNode.

null

MeshBasicNodeMaterial.geometryNode


readonly isMaterial: boolean

Defined in: three.js/materials/Material:isMaterial 

This flag can be used for type testing.

true

MeshBasicNodeMaterial.isMaterial


readonly isMeshBasicNodeMaterial: boolean

Defined in: three.js/materials/nodes/MeshBasicNodeMaterial:isMeshBasicNodeMaterial 

This flag can be used for type testing.

true

MeshBasicNodeMaterial.isMeshBasicNodeMaterial


readonly isNodeMaterial: boolean

Defined in: three.js/materials/nodes/NodeMaterial:isNodeMaterial 

This flag can be used for type testing.

true

MeshBasicNodeMaterial.isNodeMaterial


lightMap: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:lightMap 

The light map. Requires a second set of UVs.

lightMap represents pre-baked illuminance data, and the texture must be assigned a Texture#colorSpace . Most lightMap textures set texture.colorSpace = LinearSRGBColorSpace and use float-type formats such as .exr or .hdr.

null

MeshBasicNodeMaterial.lightMap


lightMapIntensity: number

Defined in: three.js/materials/MeshBasicMaterial:lightMapIntensity 

Intensity of the baked light.

1

MeshBasicNodeMaterial.lightMapIntensity


lights: boolean

Defined in: three.js/materials/nodes/NodeMaterial:lights 

Whether this material is affected by lights or not.

false

MeshBasicNodeMaterial.lights


lightsNode: LightsNode  | null

Defined in: three.js/materials/nodes/NodeMaterial:lightsNode 

Node materials which set their lights property to true are affected by all lights of the scene. Sometimes selective lighting is wanted which means only some lights in the scene affect a material. This can be achieved by creating an instance of LightsNode  with a list of selective lights and assign the node to this property.

const customLightsNode = lights( [ light1, light2 ] );
material.lightsNode = customLightsNode;
null

MeshBasicNodeMaterial.lightsNode


map: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:map 

The color map. May optionally include an alpha channel, typically combined with Material#transparent or Material#alphaTest. The texture map color is modulated by the diffuse color.

map represents color data, and the texture must be assigned a Texture#colorSpace . Most map textures set texture.colorSpace = SRGBColorSpace.

null

MeshBasicNodeMaterial.map


maskNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:maskNode 

Discards the fragment if the mask value is false.

null

MeshBasicNodeMaterial.maskNode


maskShadowNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:maskShadowNode 

This node can be used to implement a shadow mask for the material.

null

MeshBasicNodeMaterial.maskShadowNode


mrtNode: MRTNode  | null

Defined in: three.js/materials/nodes/NodeMaterial:mrtNode 

MRT configuration is done on renderer or pass level. This node allows to overwrite what values are written into MRT targets on material level. This can be useful for implementing selective FX features that should only affect specific objects.

null

MeshBasicNodeMaterial.mrtNode


name: string

Defined in: three.js/materials/Material:name 

The name of the material.

MeshBasicNodeMaterial.name


normalNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:normalNode 

The normals of node materials are by default inferred from the normalMap/normalScale or bumpMap/bumpScale properties. This node property allows to overwrite the default and define the normals with a node instead.

If you don’t want to overwrite the normals but modify the existing values instead, use materialNormal.

null

MeshBasicNodeMaterial.normalNode


opacity: number

Defined in: three.js/materials/Material:opacity 

Defines how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque.

If the Material#transparent is not set to true, the material will remain fully opaque and this value will only affect its color.

1

MeshBasicNodeMaterial.opacity


opacityNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:opacityNode 

The opacity of node materials is by default inferred from the opacity and alphaMap properties. This node property allows to overwrite the default and define the opacity with a node instead.

If you don’t want to overwrite the opacity but modify the existing value instead, use materialOpacity.

null

MeshBasicNodeMaterial.opacityNode


outputNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:outputNode 

This node can be used to define the final output of the material.

TODO: Explain the differences to fragmentNode.

null

MeshBasicNodeMaterial.outputNode


polygonOffset: boolean

Defined in: three.js/materials/Material:polygonOffset 

Whether to use polygon offset or not. When enabled, each fragment’s depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The offset is added before the depth test is performed and before the value is written into the depth buffer.

Can be useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges.

false

MeshBasicNodeMaterial.polygonOffset


polygonOffsetFactor: number

Defined in: three.js/materials/Material:polygonOffsetFactor 

Specifies a scale factor that is used to create a variable depth offset for each polygon.

0

MeshBasicNodeMaterial.polygonOffsetFactor


polygonOffsetUnits: number

Defined in: three.js/materials/Material:polygonOffsetUnits 

Is multiplied by an implementation-specific value to create a constant depth offset.

0

MeshBasicNodeMaterial.polygonOffsetUnits


positionNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:positionNode 

The local vertex positions are computed based on multiple factors like the attribute data, morphing or skinning. This node property allows to overwrite the default and define local vertex positions with nodes instead.

If you don’t want to overwrite the vertex positions but modify the existing values instead, use positionLocal.

material.positionNode = positionLocal.add( displace );
null

MeshBasicNodeMaterial.positionNode


precision: "highp" | "mediump" | "lowp" | null

Defined in: three.js/materials/Material:precision 

Override the renderer’s default precision for this material.

null

MeshBasicNodeMaterial.precision


premultipliedAlpha: boolean

Defined in: three.js/materials/Material:premultipliedAlpha 

Whether to premultiply the alpha (transparency) value.

false

MeshBasicNodeMaterial.premultipliedAlpha


receivedShadowNode: (() => Node ) | null

Defined in: three.js/materials/nodes/NodeMaterial:receivedShadowNode 

This node can be used to influence how an object using this node material receive shadows.

const totalShadows = float( 1 ).toVar();
material.receivedShadowNode = Fn( ( [ shadow ] ) => {
totalShadows.mulAssign( shadow );
//return float( 1 ); // bypass received shadows
return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color
} );
@default null
#### Inherited from
`MeshBasicNodeMaterial.receivedShadowNode`
***
### receivedShadowPositionNode
> **receivedShadowPositionNode**: [`Node`](https://threejs.org/docs/) \| `null`
Defined in: [three.js/materials/nodes/NodeMaterial:receivedShadowPositionNode](https://threejs.org/docs/#api/en/materials/nodes/NodeMaterial.receivedShadowPositionNode)
Allows to overwrite the position used for shadow map rendering which
is by default positionWorld, the vertex position
in world space.
#### Default
```ts
null

MeshBasicNodeMaterial.receivedShadowPositionNode


reflectivity: number

Defined in: three.js/materials/MeshBasicMaterial:reflectivity 

How much the environment map affects the surface. The valid range is between 0 (no reflections) and 1 (full reflections).

1

MeshBasicNodeMaterial.reflectivity


refractionRatio: number

Defined in: three.js/materials/MeshBasicMaterial:refractionRatio 

The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with environment mapping modes CubeRefractionMapping and EquirectangularRefractionMapping. The refraction ratio should not exceed 1.

0.98

MeshBasicNodeMaterial.refractionRatio


shadowSide: Side  | null

Defined in: three.js/materials/Material:shadowSide 

Defines which side of faces cast shadows. If null, the side casting shadows is determined as follows:

  • When Material#side is set to FrontSide, the back side cast shadows.
  • When Material#side is set to BackSide, the front side cast shadows.
  • When Material#side is set to DoubleSide, both sides cast shadows.
null

MeshBasicNodeMaterial.shadowSide


side: Side 

Defined in: three.js/materials/Material:side 

Defines which side of faces will be rendered - front, back or both.

FrontSide

MeshBasicNodeMaterial.side


specularMap: Texture <unknown, TextureEventMap > | null

Defined in: three.js/materials/MeshBasicMaterial:specularMap 

Specular map used by the material.

specularMap represents color data, and the texture must be assigned a Texture#colorSpace . Most specularMap textures set texture.colorSpace = SRGBColorSpace.

null

MeshBasicNodeMaterial.specularMap


stencilFail: StencilOp 

Defined in: three.js/materials/Material:stencilFail 

Which stencil operation to perform when the comparison function returns false.

KeepStencilOp

MeshBasicNodeMaterial.stencilFail


stencilFunc: StencilFunc 

Defined in: three.js/materials/Material:stencilFunc 

The stencil comparison function to use.

AlwaysStencilFunc

MeshBasicNodeMaterial.stencilFunc


stencilFuncMask: number

Defined in: three.js/materials/Material:stencilFuncMask 

The bit mask to use when comparing against the stencil buffer.

0xff

MeshBasicNodeMaterial.stencilFuncMask


stencilRef: number

Defined in: three.js/materials/Material:stencilRef 

The value to use when performing stencil comparisons or stencil operations.

0

MeshBasicNodeMaterial.stencilRef


stencilWrite: boolean

Defined in: three.js/materials/Material:stencilWrite 

Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true.

false

MeshBasicNodeMaterial.stencilWrite


stencilWriteMask: number

Defined in: three.js/materials/Material:stencilWriteMask 

The bit mask to use when writing to the stencil buffer.

0xff

MeshBasicNodeMaterial.stencilWriteMask


stencilZFail: StencilOp 

Defined in: three.js/materials/Material:stencilZFail 

Which stencil operation to perform when the comparison function returns true but the depth test fails.

KeepStencilOp

MeshBasicNodeMaterial.stencilZFail


stencilZPass: StencilOp 

Defined in: three.js/materials/Material:stencilZPass 

Which stencil operation to perform when the comparison function returns true and the depth test passes.

KeepStencilOp

MeshBasicNodeMaterial.stencilZPass


toneMapped: boolean

Defined in: three.js/materials/Material:toneMapped 

Defines whether this material is tone mapped according to the renderer’s tone mapping setting.

It is ignored when rendering to a render target or using post processing or when using WebGPURenderer. In all these cases, all materials are honored by tone mapping.

true

MeshBasicNodeMaterial.toneMapped


transparent: boolean

Defined in: three.js/materials/Material:transparent 

Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects.

When set to true, the extent to which the material is transparent is controlled by Material#opacity.

false

MeshBasicNodeMaterial.transparent


type: string

Defined in: three.js/materials/Material:type 

The type property is used for detecting the object type in context of serialization/deserialization.

MeshBasicNodeMaterial.type


userData: Record<string, any>

Defined in: three.js/materials/Material:userData 

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.

MeshBasicNodeMaterial.userData


readonly uuid: string

Defined in: three.js/materials/Material:uuid 

The UUID of the material.

MeshBasicNodeMaterial.uuid


readonly version: number

Defined in: three.js/materials/Material:version 

This starts at 0 and counts how many times Material#needsUpdate  is set to true.

0

MeshBasicNodeMaterial.version


vertexColors: boolean

Defined in: three.js/materials/Material:vertexColors 

If set to true, vertex colors should be used.

The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or four (RGBA) component color buffer attribute is used.

false

MeshBasicNodeMaterial.vertexColors


vertexNode: Node  | null

Defined in: three.js/materials/nodes/NodeMaterial:vertexNode 

This node property can be used if you need complete freedom in implementing the vertex shader. Assigning a node will replace the built-in material logic used in the vertex stage.

null

MeshBasicNodeMaterial.vertexNode


visible: boolean

Defined in: three.js/materials/Material:visible 

Defines whether 3D objects using this material are visible.

true

MeshBasicNodeMaterial.visible


wireframe: boolean

Defined in: three.js/materials/MeshBasicMaterial:wireframe 

Renders the geometry as a wireframe.

false

MeshBasicNodeMaterial.wireframe


wireframeLinecap: "round" | "bevel" | "miter"

Defined in: three.js/materials/MeshBasicMaterial:wireframeLinecap 

Defines appearance of wireframe ends.

Can only be used with SVGRenderer.

'round'

MeshBasicNodeMaterial.wireframeLinecap


wireframeLinejoin: "round" | "bevel" | "miter"

Defined in: three.js/materials/MeshBasicMaterial:wireframeLinejoin 

Defines appearance of wireframe joints.

Can only be used with SVGRenderer.

'round'

MeshBasicNodeMaterial.wireframeLinejoin


wireframeLinewidth: number

Defined in: three.js/materials/MeshBasicMaterial:wireframeLinewidth 

Controls the thickness of the wireframe.

Can only be used with SVGRenderer.

1

MeshBasicNodeMaterial.wireframeLinewidth


readonly static MAX_EFFECT_FLOATS: 24 = 24

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:154

Maximum total effect-data floats allowed across all registered effects on this material. WebGPU allows 8 vertex-buffer bindings per pipeline; SpriteBatch uses 2 fixed bindings (instanceMatrix + interleaved core — the synth-quad geometry’s position/uv attributes exist for user TSL but cost a binding only when a material’s nodes actually read them), leaving 6 for effectBuf0..5 × 4 floats = 24 floats. Exceeding this would force a 7th effectBuf binding which WebGPU rejects at pipeline creation with a cryptic “vertex buffer count exceeds maximum” error. registerEffect throws clearly when the cap would be exceeded.

A material whose custom TSL nodes call uv()/positionGeometry() consumes one or two additional vertex-buffer bindings beyond the 2 above, reducing headroom below 24 floats for that material.

get alphaTest(): number

Defined in: three.js/materials/Material:alphaTest 

Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value.

0

number

set alphaTest(value): void

Defined in: three.js/materials/Material:alphaTest 

number

void

MeshBasicNodeMaterial.alphaTest


get colorTransform(): ColorTransformFn | null

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:251

Get the color transform function.

ColorTransformFn | null

set colorTransform(value): void

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:259

Set the color transform function. Triggers shader rebuild.

ColorTransformFn | null

void


get maxEffectFloats(): number

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:205

Per-instance effect-float cap for THIS material. Strategy-dependent in subclasses: tight-mesh geometry spends bindings on position/uv, shrinking the effect budget (see Sprite2DMaterial).

number


set needsUpdate(value): void

Defined in: three.js/materials/Material:needsUpdate 

Setting this property to true indicates the engine the material needs to be recompiled.

false

boolean

void

MeshBasicNodeMaterial.needsUpdate


get requiredChannels(): ReadonlySet<string>

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:271

Get the required channels set.

ReadonlySet<string>

set requiredChannels(value): void

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:279

Set the required channels. Triggers shader rebuild when channels change.

ReadonlySet<string>

void


get static type(): string

Defined in: three.js/materials/nodes/NodeMaterial:type 

string

MeshBasicNodeMaterial.type

addEventListener<T>(type, listener): void

Defined in: three.js/core/EventDispatcher:addEventListener 

Adds a listener to an event type.

T extends "dispose"

T

The type of event to listen to.

EventListener <MaterialEventMap [T], T, EffectMaterial>

The function that gets called when the event is fired.

void

MeshBasicNodeMaterial.addEventListener


build(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:build 

Builds this material with the given node builder.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.build


clone(): this

Defined in: three.js/materials/Material:clone 

Returns a new material with copied values from this instance.

this

A clone of this instance.

MeshBasicNodeMaterial.clone


copy(source): this

Defined in: three.js/materials/nodes/NodeMaterial:copy 

Copies the common properties of the given material to this instance.

Material 

The material to copy.

this

A reference to this node material.

MeshBasicNodeMaterial.copy


customProgramCacheKey(): string

Defined in: three.js/materials/Material:customProgramCacheKey 

In case Material#onBeforeCompile  is used, this callback can be used to identify values of settings used in onBeforeCompile(), so three.js can reuse a cached shader or recompile the shader for this material as needed.

This method can only be used when rendering with WebGLRenderer .

string

The custom program cache key.

MeshBasicNodeMaterial.customProgramCacheKey


dispatchEvent<T>(event): void

Defined in: three.js/core/EventDispatcher:dispatchEvent 

Fire an event type.

T extends "dispose"

BaseEvent <T> & MaterialEventMap [T]

The event that gets fired.

void

MeshBasicNodeMaterial.dispatchEvent


dispose(): void

Defined in: three.js/materials/Material:dispose 

Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.

void

Material#dispose

MeshBasicNodeMaterial.dispose


fromJSON(json, textures): this

Defined in: three.js/materials/Material:fromJSON 

Deserializes the material from the given JSON.

MaterialJSON 

The JSON holding the serialized material.

Record<string, Texture >

A dictionary holding textures referenced by the material.

this

A reference to this material.

MeshBasicNodeMaterial.fromJSON


getEffectFieldLocation(effectName, fieldName): { bufferName: string; componentIndex: number; size: number; } | undefined

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:785

Locate an effect’s schema field within the packed instance buffers. Returns the effectBufN attribute that contains this field, the float offset within a single instance’s 4-float slice of that buffer (0-3), and the field’s float width. Returns undefined if no registered effect declares the given field.

Used by instance-writing code (e.g. TileLayer, SpriteBatch) that needs to poke per-instance effect values directly without going through a MaterialEffect instance’s property setter.

string

string

{ bufferName: string; componentIndex: number; size: number; } | undefined


getEffects(): readonly typeof MaterialEffect[]

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:511

Get the list of registered effect classes.

readonly typeof MaterialEffect[]


getUsedEffectFloats(): number

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:213

Current per-instance effect-float usage (sum across all registered effects). Complements getMaxEffectFloats.

number


hasEffect(effectClass): boolean

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:504

Check if an effect class is registered on this material.

typeof MaterialEffect

boolean


hasEventListener<T>(type, listener): boolean

Defined in: three.js/core/EventDispatcher:hasEventListener 

Checks if listener is added to an event type.

T extends "dispose"

T

The type of event to listen to.

EventListener <MaterialEventMap [T], T, EffectMaterial>

The function that gets called when the event is fired.

boolean

MeshBasicNodeMaterial.hasEventListener


onBeforeCompile(parameters, renderer): void

Defined in: three.js/materials/Material:onBeforeCompile 

An optional callback that is executed immediately before the shader program is compiled. This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.

This method can only be used when rendering with WebGLRenderer . The recommended approach when customizing materials is to use WebGPURenderer with the new Node Material system and TSL .

WebGLProgramParametersWithUniforms 

WebGLRenderer 

A reference to the renderer.

void

MeshBasicNodeMaterial.onBeforeCompile


onBeforeRender(renderer, scene, camera, geometry, object, group): void

Defined in: three.js/materials/Material:onBeforeRender 

An optional callback that is executed immediately before the material is used to render a 3D object.

This method can only be used when rendering with WebGLRenderer .

WebGLRenderer 

The renderer.

Scene 

The scene.

Camera 

The camera that is used to render the scene.

BufferGeometry 

The 3D object’s geometry.

Object3D 

The 3D object.

Group 

The geometry group data.

void

MeshBasicNodeMaterial.onBeforeRender


registerEffect(effectClass, constants?): boolean

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:325

Register an effect class on this material. Assigns a bit index and packed buffer slots, then rebuilds the shader. If the effect is already registered, this is a no-op.

typeof MaterialEffect

The MaterialEffect subclass to register

Record<string, unknown>

Optional constants from the effect instance (for provider effects)

boolean

Whether the buffer tier changed (requiring batch rebuild).


removeEventListener<T>(type, listener): void

Defined in: three.js/core/EventDispatcher:removeEventListener 

Removes a listener from an event type.

T extends "dispose"

T

The type of the listener that gets removed.

EventListener <MaterialEventMap [T], T, EffectMaterial>

The listener function that gets removed.

void

MeshBasicNodeMaterial.removeEventListener


setDefaultValues(material): void

Defined in: three.js/materials/nodes/NodeMaterial:setDefaultValues 

Most classic material types have a node pendant e.g. for MeshBasicMaterial there is MeshBasicNodeMaterial. This utility method is intended for defining all material properties of the classic type in the node type.

Material 

The material to copy properties with their values to this node material.

void

MeshBasicNodeMaterial.setDefaultValues


setup(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:setup 

Setups the vertex and fragment stage of this node material.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.setup


setupAmbientOcclusion(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupAmbientOcclusion 

Setups the ambient occlusion node from the material.

NodeBuilder 

The current node builder.

Node 

The ambient occlusion node.

MeshBasicNodeMaterial.setupAmbientOcclusion


setupClipping(builder): ClippingNode 

Defined in: three.js/materials/nodes/NodeMaterial:setupClipping 

Setups the clipping node.

NodeBuilder 

The current node builder.

ClippingNode 

The clipping node.

MeshBasicNodeMaterial.setupClipping


setupDepth(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:setupDepth 

Setups the depth of this material.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.setupDepth


setupDiffuseColor(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:setupDiffuseColor 

Setups the computation of the material’s diffuse color.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.setupDiffuseColor


setupEnvironment(builder): BasicEnvironmentNode  | null

Defined in: three.js/materials/nodes/MeshBasicNodeMaterial:setupEnvironment 

Overwritten since this type of material uses BasicEnvironmentNode  to implement the default environment mapping.

NodeBuilder 

The current node builder.

BasicEnvironmentNode  | null

The environment node.

MeshBasicNodeMaterial.setupEnvironment


setupFog(builder, outputNode): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupFog 

Setup the fog.

NodeBuilder 

The current node builder.

Node 

The existing output node.

Node 

The output node.

MeshBasicNodeMaterial.setupFog


setupHardwareClipping(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:setupHardwareClipping 

Setups the hardware clipping if available on the current device.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.setupHardwareClipping


setupLighting(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupLighting 

Setups the outgoing light node.

NodeBuilder 

The current node builder.

Node 

The outgoing light node.

MeshBasicNodeMaterial.setupLighting


setupLightingModel(): BasicLightingModel 

Defined in: three.js/materials/nodes/MeshBasicNodeMaterial:setupLightingModel 

Setups the lighting model.

BasicLightingModel 

The lighting model.

MeshBasicNodeMaterial.setupLightingModel


setupLightMap(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupLightMap 

Setups the light map node from the material.

NodeBuilder 

The current node builder.

Node 

The light map node.

MeshBasicNodeMaterial.setupLightMap


setupMaterialLightings(builder): LightingNode []

Defined in: three.js/materials/nodes/NodeMaterial:setupMaterialLightings 

Setups the lights node based on the scene, environment and material.

NodeBuilder 

The current node builder.

LightingNode []

The lights node.

MeshBasicNodeMaterial.setupMaterialLightings


setupModelViewProjection(): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupModelViewProjection 

Setups the position in clip space.

Node 

The position in view space.

MeshBasicNodeMaterial.setupModelViewProjection


setupNormal(): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupNormal 

Setups the normal node from the material.

Node 

The normal node.

MeshBasicNodeMaterial.setupNormal


setupObserver(builder): NodeMaterialObserver 

Defined in: three.js/materials/nodes/NodeMaterial:setupObserver 

Setups a node material observer with the given builder.

NodeBuilder 

The current node builder.

NodeMaterialObserver 

The node material observer.

MeshBasicNodeMaterial.setupObserver


setupOutgoingLight(): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupOutgoingLight 

Setups the outgoing light node variable

Node 

The outgoing light node.

MeshBasicNodeMaterial.setupOutgoingLight


setupOutput(builder, outputNode): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupOutput 

Setups the output node.

This method can be implemented by derived materials to extend the functionality of the material’s output or replace it altogether.

class ColoredShadowMaterial extends MeshPhongNodeMaterial {
constructor( parameters ) {
super( parameters );
this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) );
}
setupOutput( builder, outputNode ) {
// Modify the native output of the MeshPhongNodeMaterial fragment shader
const brightness = min( outputNode.r, 1.0 );
const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness );
// Return new output back into NodeMaterial flow
return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) );
}
}

NodeBuilder 

The current node builder.

Node 

The existing output node.

Node 

The output node.

MeshBasicNodeMaterial.setupOutput


setupPosition(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupPosition 

Setups the computation of the position in local space.

NodeBuilder 

The current node builder.

Node 

The position in local space.

MeshBasicNodeMaterial.setupPosition


setupPositionView(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupPositionView 

Setups the position node in view space. This method exists so derived node materials can modify the implementation e.g. sprite materials.

NodeBuilder 

The current node builder.

Node 

The position in view space.

MeshBasicNodeMaterial.setupPositionView


setupPremultipliedAlpha(builder, outputNode): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupPremultipliedAlpha 

Setups premultiplied alpha.

NodeBuilder 

The current node builder.

Node 

The existing output node.

Node 

The output node.

MeshBasicNodeMaterial.setupPremultipliedAlpha


abstract setupVariants(builder): void

Defined in: three.js/materials/nodes/NodeMaterial:setupVariants 

Abstract interface method that can be implemented by derived materials to setup material-specific node variables.

NodeBuilder 

The current node builder.

void

MeshBasicNodeMaterial.setupVariants


setupVertex(builder): Node 

Defined in: three.js/materials/nodes/NodeMaterial:setupVertex 

Setups the logic for the vertex stage.

NodeBuilder 

The current node builder.

Node 

The position in clip space.

MeshBasicNodeMaterial.setupVertex


setValues(values?): void

Defined in: three.js/materials/nodes/MeshBasicNodeMaterial:setValues 

MeshBasicNodeMaterialParameters 

void

MeshBasicNodeMaterial.setValues


toJSON(meta?): MaterialJSON 

Defined in: three.js/materials/Material:toJSON 

Serializes the material into JSON.

JSONMeta 

An optional value holding meta information about the serialization.

MaterialJSON 

A JSON object representing the serialized material.

ObjectLoader#parse

MeshBasicNodeMaterial.toJSON


static getMaxEffectFloats(): number

Defined in: packages/three-flatland/src/materials/EffectMaterial.ts:196

Return the maximum number of per-instance effect floats this material type supports. See MAX_EFFECT_FLOATS.

number