Documentation - v19.12.0-dev
    Preparing search index...

    LineDashedMaterial variant used by batched, dashed line containers: per-proxy appearance is read from a MaterialPropertyTexture instead of the material's own fields.

    Hierarchy

    • Mixin<typeof LineDashedMaterial, this> & LineDashedMaterial<this>
      • BatchedLineDashedMaterial
    Index

    Constructors

    Properties

    allowOverride: boolean

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

    true
    
    alphaHash: boolean

    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
    
    alphaTestNode: Node | null

    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
    
    alphaToCoverage: boolean

    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
    
    aoNode: Node | null

    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
    
    backdropAlphaNode: Node | null

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

    null
    
    backdropNode: Node | null

    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
    
    blendAlpha: number

    Represents the alpha value of the constant blend color.

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

    0
    
    blendColor: Color

    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)
    
    blendDst: BlendingDstFactor

    Defines the blending destination factor.

    OneMinusSrcAlphaFactor
    
    blendDstAlpha: BlendingDstFactor | null

    Defines the blending destination alpha factor.

    null
    
    blendEquation: BlendingEquation

    Defines the blending equation.

    AddEquation
    
    blendEquationAlpha: BlendingEquation | null

    Defines the blending equation of the alpha channel.

    null
    
    blending: 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
    
    blendSrc: BlendingSrcFactor

    Defines the blending source factor.

    SrcAlphaFactor
    
    blendSrcAlpha: BlendingSrcFactor | null

    Defines the blending source alpha factor.

    null
    
    castShadowNode: Node | null

    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
    
    castShadowPositionNode: Node | null

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

    null
    
    clipIntersection: boolean

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

    false
    
    clippingPlanes: Plane[] | null

    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
    
    clipShadows: boolean

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

    false
    
    color: Color

    Color of the material.

    (1,1,1)
    
    colorNode:
        | Node<"vec3">
        | Node<"float">
        | Node<"vec2">
        | Node<"vec4">
        | Node<"color">
        | null

    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
    
    colorWrite: boolean

    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
    
    contextNode: ContextNode<unknown> | null

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

    null
    
    dashOffset: number

    The dash offset.

    0
    
    dashScaleNode: Node | null

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

    If you don't want to overwrite the scale but modify the existing value instead, use materialLineScale.

    null
    
    dashSize: number

    The size of the dash. This is both the gap with the stroke.

    3
    
    dashSizeNode: Node | null

    The dash size of dash materials is by default inferred from the dashSize property. This node property allows to overwrite the default and define the dash size with a node instead.

    If you don't want to overwrite the dash size but modify the existing value instead, use materialLineDashSize.

    null
    
    defines?: Record<string, unknown>
    depthFunc: DepthModes

    Defines the depth function.

    LessEqualDepth
    
    depthNode: Node | null

    Allows to overwrite depth values in the fragment shader.

    null
    
    depthTest: boolean

    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
    
    depthWrite: boolean

    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
    
    dithering: boolean

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

    false
    
    envNode: Node | null

    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
    
    fog: boolean

    Whether the material is affected by fog or not.

    true
    
    forceSinglePass: boolean

    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
    
    fragmentNode: Node | null

    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
    
    gapSize: number

    The size of the gap.

    1
    
    gapSizeNode: Node | null

    The gap size of dash materials is by default inferred from the gapSize property. This node property allows to overwrite the default and define the gap size with a node instead.

    If you don't want to overwrite the gap size but modify the existing value instead, use materialLineGapSize.

    null
    
    geometryNode: Node | null

    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
    
    isBatchedMaterial: true
    isLineBasicMaterial: boolean

    This flag can be used for type testing.

    true
    
    isLineDashedMaterial: boolean

    This flag can be used for type testing.

    true
    
    isMaterial: boolean

    This flag can be used for type testing.

    true
    
    lights: boolean

    Whether this material is affected by lights or not.

    false
    
    lightsNode: LightsNode | null

    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
    
    linecap: "round" | "butt" | "square"

    Defines appearance of line ends.

    Can only be used with SVGRenderer.

    'round'
    
    linejoin: "round" | "bevel" | "miter"

    Defines appearance of line joints.

    Can only be used with SVGRenderer.

    'round'
    
    linewidth: number

    Controls line thickness or lines.

    Can only be used with SVGRenderer. WebGL and WebGPU ignore this setting and always render line primitives with a width of one pixel.

    1
    
    map: Texture<unknown, TextureEventMap> | null

    Sets the color of the lines using data from a texture. 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
    
    maskNode: Node | null

    Discards the fragment if the mask value is false.

    null
    
    maskShadowNode: Node | null

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

    null
    
    mrtNode: MRTNode | null

    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
    
    name: string

    The name of the material.

    normalNode: Node | null

    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
    
    offsetNode: Node | null

    The offset of dash materials is by default inferred from the dashOffset property. This node property allows to overwrite the default and define the offset with a node instead.

    If you don't want to overwrite the offset but modify the existing value instead, use materialLineDashOffset.

    null
    
    opacity: number

    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
    
    opacityNode: Node | null

    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
    
    outputNode: Node | null

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

    Unlike NodeMaterial#fragmentNode, the built-in material logic (diffuse color, lighting, etc.) is still evaluated; assigning a node only replaces the resulting output color.

    null
    
    polygonOffset: boolean

    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
    
    polygonOffsetFactor: number

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

    0
    
    polygonOffsetUnits: number

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

    0
    
    positionNode: Node | null

    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
    
    precision: "highp" | "mediump" | "lowp" | null

    Override the renderer's default precision for this material.

    null
    
    premultipliedAlpha: boolean

    Whether to premultiply the alpha (transparency) value.

    false
    
    propertiesTexture: MaterialPropertyTexture
    receivedShadowNode: (() => Node) | null

    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
    receivedShadowPositionNode: Node | null

    Allows to overwrite the position used for shadow map rendering which is by default positionWorld, the vertex position in world space.

    null
    
    scale: number

    The scale of the dashed part of a line.

    1
    
    shadowSide: Side | null

    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
    
    side: Side

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

    FrontSide
    
    stencilFail: StencilOp

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

    KeepStencilOp
    
    stencilFunc: StencilFunc

    The stencil comparison function to use.

    AlwaysStencilFunc
    
    stencilFuncMask: number

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

    0xff
    
    stencilRef: number

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

    0
    
    stencilWrite: boolean

    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
    
    stencilWriteMask: number

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

    0xff
    
    stencilZFail: StencilOp

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

    KeepStencilOp
    
    stencilZPass: StencilOp

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

    KeepStencilOp
    
    toneMapped: boolean

    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
    
    transparent: boolean

    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
    
    type: string

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

    uniforms?: Record<string, IUniform<any>>
    uniformsNeedUpdate: boolean = false
    useMaterialColor: boolean
    userData: Record<string, any>

    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.

    useXray: boolean
    uuid: string

    The UUID of the material.

    version: number

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

    0
    
    vertexColors: boolean

    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
    
    vertexNode: Node | null

    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
    
    visible: boolean

    Defines whether 3D objects using this material are visible.

    true
    
    xrayOpacity: number

    Accessors

    • get alphaTest(): number

      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.

      Returns number

      0
      
    • set alphaTest(value: number): void

      Parameters

      • value: number

      Returns void

    • set needsUpdate(value: boolean): void

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

      Parameters

      • value: boolean

      Returns void

      false
      

    Methods

    • Adds a listener to an event type.

      Type Parameters

      • T extends "dispose"

      Parameters

      • type: T

        The type of event to listen to.

      • listener: EventListener<MaterialEventMap[T], T, BatchedLineDashedMaterial>

        The function that gets called when the event is fired.

      Returns void

    • Returns a new material with copied values from this instance.

      Returns this

      A clone of this instance.

    • Copies the values of the given material to this instance.

      Parameters

      • source: Material

        The material to copy.

      Returns this

      A reference to this instance.

    • 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.

      Returns string

      The custom program cache key.

    • Fire an event type.

      Type Parameters

      • T extends "dispose"

      Parameters

      • event: BaseEvent<T> & MaterialEventMap[T]

        The event that gets fired.

      Returns void

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

      Returns void

      Material#dispose

    • Deserializes the material from the given JSON.

      Parameters

      • json: MaterialJSON

        The JSON holding the serialized material.

      • textures: Record<string, Texture>

        A dictionary holding textures referenced by the material.

      Returns this

      A reference to this material.

    • Checks if listener is added to an event type.

      Type Parameters

      • T extends "dispose"

      Parameters

      • type: T

        The type of event to listen to.

      • listener: EventListener<MaterialEventMap[T], T, BatchedLineDashedMaterial>

        The function that gets called when the event is fired.

      Returns boolean

    • Parameters

      • parameters: WebGLProgramParametersWithUniforms

      Returns void

    • 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.

      Returns void

    • 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.

      Parameters

      • renderer: WebGLRenderer

        The renderer.

      • scene: Scene

        The scene.

      • camera: Camera

        The camera that is used to render the scene.

      • geometry: BufferGeometry

        The 3D object's geometry.

      • object: Object3D

        The 3D object.

      • group: Group

        The geometry group data.

      Returns void

    • Removes a listener from an event type.

      Type Parameters

      • T extends "dispose"

      Parameters

      • type: T

        The type of the listener that gets removed.

      • listener: EventListener<MaterialEventMap[T], T, BatchedLineDashedMaterial>

        The listener function that gets removed.

      Returns void

    • This method can be used to set default values from parameter objects. It is a generic implementation so it can be used with different types of materials.

      Parameters

      • Optionalvalues: MaterialParameters

        The material values to set.

      Returns void

    • Parameters

      • Optionalvalues: LineDashedMaterialParameters

      Returns void

    • Serializes the material into JSON.

      Parameters

      • Optionalmeta: JSONMeta

        An optional value holding meta information about the serialization.

      Returns MaterialJSON

      A JSON object representing the serialized material.

      ObjectLoader#parse