Home Reference Source
import {EdgeDetectionMaterial} from 'postprocessing'
public class | source

EdgeDetectionMaterial

Extends:

three~ShaderMaterial → EdgeDetectionMaterial

Implements:

An edge detection material. Mainly used for SMAA.

Constructor Summary

Public Constructor
public

constructor(texelSize: Vector2, mode: EdgeDetectionMode)

Constructs a new edge detection material.

Member Summary

Public Members
public set

depthBuffer: Texture

The depth buffer.

public set

depthPacking: DepthPackingStrategies

The depth packing strategy.

public get

The edge detection mode.

public set
public get

The edge detection threshold.

public set
public get

The local contrast adaptation factor.

public set
public
public set

The predication buffer.

public get

The predication mode.

public set
public get

The predication scale.

public set
public get

The predication strength.

public set
public get

The predication threshold.

public set

Method Summary

Public Methods
public
this method was deprecated. Use edgeDetectionMode instead.

Returns the edge detection mode.

public
this method was deprecated. Use edgeDetectionThreshold instead.

Returns the edge detection threshold.

public
this method was deprecated. Use localContrastAdaptationFactor instead.

Returns the local contrast adaptation factor.

public
this method was deprecated. Use predicationMode instead.

Returns the predication mode.

public
this method was deprecated. Use predicationScale instead.

Returns the predication scale.

public
this method was deprecated. Use predicationStrength instead.

Returns the predication strength.

public
this method was deprecated. Use predicationThreshold instead.

Returns the predication threshold.

public

setDepthBuffer(buffer: Texture, depthPacking: DepthPackingStrategies)

this method was deprecated. Use depthBuffer and depthPacking instead.

Sets the depth buffer.

public
this method was deprecated. Use edgeDetectionMode instead.

Sets the edge detection mode.

public
this method was deprecated. Use edgeDetectionThreshold instead.

Sets the edge detection threshold.

public
this method was deprecated. Use localContrastAdaptationFactor instead.

Sets the local contrast adaptation factor.

public

setPredicationBuffer(value: Texture)

this method was deprecated. Use predicationBuffer instead.

Sets a custom predication buffer.

public
this method was deprecated. Use predicationMode instead.

Sets the predication mode.

public
this method was deprecated. Use predicationScale instead.

Sets the predication scale.

public
this method was deprecated. Use predicationStrength instead.

Sets the predication strength.

public
this method was deprecated. Use predicationThreshold instead.

Sets the predication threshold.

public

setSize(width: Number, height: Number)

Sets the size of this object.

Public Constructors

public constructor(texelSize: Vector2, mode: EdgeDetectionMode) source

Constructs a new edge detection material.

TODO Remove parameters.

Params:

NameTypeAttributeDescription
texelSize Vector2
  • optional

The screen texel size.

mode EdgeDetectionMode
  • optional
  • default: EdgeDetectionMode.COLOR

The edge detection mode.

Public Members

public set depthBuffer: Texture source

The depth buffer.

public set depthPacking: DepthPackingStrategies source

The depth packing strategy.

public get edgeDetectionMode: EdgeDetectionMode source

The edge detection mode.

public set edgeDetectionMode source

public get edgeDetectionThreshold: Number source

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.

public set edgeDetectionThreshold source

public get localContrastAdaptationFactor: Number source

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.

public set localContrastAdaptationFactor source

public needsUpdate: boolean source

public set predicationBuffer: Texture source

The predication buffer.

public get predicationMode: PredicationMode source

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.

public set predicationMode source

public get predicationScale: Boolean | Texture | Number source

The predication scale. Range: [1.0, 5.0].

Determines how much the edge detection threshold should be scaled when using predication.

public set predicationScale source

public get predicationStrength: Number source

The predication strength. Range: [0.0, 1.0].

Determines how much the edge detection threshold should be decreased locally when using predication.

public set predicationStrength source

public get predicationThreshold: Number source

The predication threshold.

public set predicationThreshold source

Public Methods

public getEdgeDetectionMode(): EdgeDetectionMode source

this method was deprecated. Use edgeDetectionMode instead.

Returns the edge detection mode.

Return:

EdgeDetectionMode

The mode.

public getEdgeDetectionThreshold(): Number source

this method was deprecated. Use edgeDetectionThreshold instead.

Returns the edge detection threshold.

Return:

Number

The threshold.

public getLocalContrastAdaptationFactor(): Number source

this method was deprecated. Use localContrastAdaptationFactor instead.

Returns the local contrast adaptation factor.

Return:

Number

The factor.

public getPredicationMode(): PredicationMode source

this method was deprecated. Use predicationMode instead.

Returns the predication mode.

Return:

PredicationMode

The mode.

public getPredicationScale(): Number source

this method was deprecated. Use predicationScale instead.

Returns the predication scale.

Return:

Number

The scale.

public getPredicationStrength(): Number source

this method was deprecated. Use predicationStrength instead.

Returns the predication strength.

Return:

Number

The strength.

public getPredicationThreshold(): Number source

this method was deprecated. Use predicationThreshold instead.

Returns the predication threshold.

Return:

Number

The threshold.

public setDepthBuffer(buffer: Texture, depthPacking: DepthPackingStrategies) source

this method was deprecated. Use depthBuffer and depthPacking instead.

Sets the depth buffer.

Params:

NameTypeAttributeDescription
buffer Texture

The depth texture.

depthPacking DepthPackingStrategies
  • optional
  • default: BasicDepthPacking

The depth packing strategy.

public setEdgeDetectionMode(value: EdgeDetectionMode) source

this method was deprecated. Use edgeDetectionMode instead.

Sets the edge detection mode.

Params:

NameTypeAttributeDescription
value EdgeDetectionMode

The edge detection mode.

public setEdgeDetectionThreshold(value: Number) source

this method was deprecated. Use edgeDetectionThreshold instead.

Sets the edge detection threshold.

Params:

NameTypeAttributeDescription
value Number

The edge detection threshold. Range: [0.0, 0.5].

public setLocalContrastAdaptationFactor(value: Number) source

this method was deprecated. Use localContrastAdaptationFactor instead.

Sets the local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH.

Params:

NameTypeAttributeDescription
value Number

The local contrast adaptation factor. Default is 2.0.

public setPredicationBuffer(value: Texture) source

this method was deprecated. Use predicationBuffer instead.

Sets a custom predication buffer.

Params:

NameTypeAttributeDescription
value Texture

The predication buffer.

public setPredicationMode(value: PredicationMode) source

this method was deprecated. Use predicationMode instead.

Sets the predication mode.

Params:

NameTypeAttributeDescription
value PredicationMode

The predication mode.

public setPredicationScale(value: Number) source

this method was deprecated. Use predicationScale instead.

Sets the predication scale.

Params:

NameTypeAttributeDescription
value Number

The scale. Range: [1.0, 5.0].

public setPredicationStrength(value: Number) source

this method was deprecated. Use predicationStrength instead.

Sets the predication strength.

Params:

NameTypeAttributeDescription
value Number

The strength. Range: [0.0, 1.0].

public setPredicationThreshold(value: Number) source

this method was deprecated. Use predicationThreshold instead.

Sets the predication threshold.

Params:

NameTypeAttributeDescription
value Number

The threshold.

public setSize(width: Number, height: Number) source

Sets the size of this object.

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.