EdgeDetectionMaterial
Extends:
An edge detection material.
Mainly used for Subpixel Morphological Antialiasing.
Constructor Summary
Public Constructor | ||
public |
constructor(texelSize: Vector2, mode: EdgeDetectionMode) Constructs a new edge detection material. |
Member Summary
Public Members | ||
public get |
The current depth packing. |
|
public set |
Sets the depth packing. |
|
public |
|
|
public |
|
Method Summary
Public Methods | ||
public |
Sets the edge detection mode. |
|
public |
setEdgeDetectionThreshold(threshold: Number) Sets the edge detection sensitivity. |
|
public |
setLocalContrastAdaptationFactor(factor: Number) Sets the local contrast adaptation factor. |
Public Constructors
public constructor(texelSize: Vector2, mode: EdgeDetectionMode) source
Constructs a new edge detection material.
Params:
Name | Type | Attribute | Description |
texelSize | Vector2 |
|
The screen texel size. |
mode | EdgeDetectionMode |
|
The edge detection mode. |
TODO:
- Remove texelSize parameter.
Public Members
public set depthPacking: Number source
Sets the depth packing.
Use BasicDepthPacking
or RGBADepthPacking
if your depth texture
contains packed depth.
You'll need to call EffectPass#recompile after changing this value.
public fragmentShader: * source
Public Methods
public setEdgeDetectionMode(mode: EdgeDetectionMode) source
Sets the edge detection mode.
Warning: If you intend to change the edge detection mode at runtime, make
sure that EffectPass.needsDepthTexture is set to true
before
the EffectPass is added to the composer.
Params:
Name | Type | Attribute | Description |
mode | EdgeDetectionMode | The edge detection mode. |
public setEdgeDetectionThreshold(threshold: Number) source
Sets the edge detection sensitivity.
A lower value results in more edges being detected at the expense of performance.
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.
If temporal supersampling is used, 0.2 could be a reasonable value, as low contrast edges are properly filtered by just 2x.
Params:
Name | Type | Attribute | Description |
threshold | Number | The edge detection sensitivity. Range: [0.05, 0.5]. |
public setLocalContrastAdaptationFactor(factor: Number) source
Sets the local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH.
If there is a neighbor edge that 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.
Params:
Name | Type | Attribute | Description |
factor | Number | The local contrast adaptation factor. Default is 2.0. |