Constructs a new edge detection material.
TODO Remove parameters.
Optional
texelSize: Vector2The screen texel size.
Optional
mode: EdgeDetectionModeThe edge detection mode.
Enables alpha hashed transparency, an alternative to .transparent or .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 TAARenderPass can reduce the resulting noise.
Enables alpha to coverage. Can only be used with MSAA-enabled rendering 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
Represents the alpha value of the constant blend color. This property has only an effect when using custom blending with ConstantAlphaFactor or OneMinusConstantAlphaFactor.
0
Represent the RGB values of the constant blend color. This property has only an effect when using custom blending with ConstantColorFactor or OneMinusConstantColorFactor.
0x000000
Blending destination. It's one of the blending mode constants defined in Three.js. Default is OneMinusSrcAlphaFactor.
THREE.OneMinusSrcAlphaFactor
The tranparency of the .blendDst. Default is null.
null
Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation.
THREE.AddEquation
The tranparency of the .blendEquation. Default is null.
null
Blending source. It's one of the blending mode constants defined in Three.js. Default is SrcAlphaFactor.
THREE.SrcAlphaFactor
The tranparency of the .blendSrc. Default is null.
null
Which blending to use when displaying objects with this material. Default is NormalBlending.
THREE.NormalBlending
Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
false
Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
false
false
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). See the WebGL / clipping /intersection example. Default is null.
null
Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true.
true
{ 'color': [ 1, 1, 1 ], 'uv': [ 0, 0 ], 'uv1': [ 0, 0 ] }
{}
Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.
THREE.LessEqualDepth
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
Whether rendering this material has any effect on the depth buffer. Default is true. 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
Whether to apply dithering to the color to remove the appearance of banding. Default is false.
false
{
* clipCullDistance: false,
* multiDraw: false
* }
false
false
null
Unique number of this material instance.
undefined
Readonly
isRead-only flag to check if a given object is of type Material.
This is a constant value
true
Readonly
isRead-only flag to check if a given object is of type ShaderMaterial.
This is a constant value
true
false
1
Material name. Default is an empty string.
''
Opacity. Default is 1.
1
Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
false
Sets the polygon offset factor. Default is 0.
0
Sets the polygon offset units. Default is 0.
0
Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null.
null
Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false.
false
Defines which of the face sides will cast shadows. Default is null. If null, the value is opposite that of side, above.
null
Defines which of the face sides will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.
{@link THREE.FrontSide}
Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operation constants for all possible values.
THREE.KeepStencilOp
The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil operation constants for all possible values.
THREE.AlwaysStencilFunc
The bit mask to use when comparing against the stencil buffer. Default is 0xFF.
0xff
The value to use when performing stencil comparisons or stencil operations. Default is 0.
0
Whether rendering this material has any effect on the stencil buffer. Default is false.
false
The bit mask to use when writing to the stencil buffer. Default is 0xFF.
0xff
Which stencil operation to perform when the comparison function returns true but the depth test fails. Default is KeepStencilOp. See the stencil operation constants for all possible values.
THREE.KeepStencilOp
Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is KeepStencilOp. See the stencil operation constants for all possible values.
THREE.KeepStencilOp
Defines whether this material is tone mapped according to the renderer's WebGLRenderer.toneMapping toneMapping setting. It is ignored when rendering to a render target or using post processing.
true
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 setting it's .opacity property.
false
Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a scene.
{}
false
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.
{}
UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
This starts at 0 and counts how many times .needsUpdate is set to true.
0
Defines whether vertex coloring is used. Default is false.
false
Defines whether this material is visible. Default is true.
true
false
1
Gets the alpha value to be used when running an alpha test. Default is 0.
0
Sets the alpha value to be used when running an alpha test. Default is 0.
0
The depth buffer.
The depth packing strategy.
The edge detection mode.
The edge detection threshold. Range: [0.0, 0.5].
A lower value results in more edges being detected at the expense of performance.
For luma- and chroma-based edge detection, 0.1 is a reasonable value and allows to catch most visible edges. 0.05 is a rather overkill value that allows to catch 'em all. Darker scenes may require an even lower threshold.
If depth-based edge detection is used, the threshold will depend on the scene depth.
The local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH. Default is 2.0.
If a neighbor edge has factor times bigger contrast than the current edge, the edge will be discarded.
This allows to eliminate spurious crossing edges and is based on the fact that if there is too much contrast in a direction, the perceptual contrast in the other neighbors will be hidden.
Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. This property is automatically set to true when instancing a new material.
false
The predication buffer.
The predication mode.
Predicated thresholding allows to better preserve texture details and to improve edge detection using an additional buffer such as a light accumulation or depth buffer.
The predication scale. Range: [1.0, 5.0].
Determines how much the edge detection threshold should be scaled when using predication.
The predication strength. Range: [0.0, 1.0].
Determines how much the edge detection threshold should be decreased locally when using predication.
The predication threshold.
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Return a new material with the same parameters as this material.
Copy the parameters from the passed material into this material.
Returns the edge detection mode.
The mode.
Use edgeDetectionMode instead.
Returns the predication mode.
The mode.
Use predicationMode instead.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
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, but the recommended approach moving forward is to use
WebGPURenderer
with the new Node Material system and
[TSL]https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language.
Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
WebGL program parameters
WebGLRenderer context that is initializing the material
An optional callback that is executed immediately before the material is used to render a 3D object.
Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
Sets the edge detection mode.
The edge detection mode.
Use edgeDetectionMode instead.
Sets the predication mode.
The predication mode.
Use predicationMode instead.
An edge detection material.
Mainly used for Subpixel Morphological Anti-Aliasing.
Implements