GlitchEffect
Extends:
Indirect Implements:
A glitch effect.
This effect can influence the ChromaticAberrationEffect.
Reference: https://github.com/staffantan/unityglitch
Warning: This effect cannot be merged with convolution effects.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Constructs a new glitch effect. |
Member Summary
Public Members | ||
public get |
Indicates whether the glitch effect is currently active. |
|
public |
chromaticAberrationOffset: Vector2 The chromatic aberration offset. |
|
public |
delay: Vector2 The minimum and maximum delay between glitch activations in seconds. |
|
public |
duration: Vector2 The minimum and maximum duration of a glitch in seconds. |
|
public |
The effect mode. |
|
public |
The threshold for strong glitches, ranging from 0 to 1 where 0 means no weak glitches and 1 means no strong ones. |
|
public |
strength: Vector2 The strength of weak and strong glitches. |
Method Summary
Public Methods | ||
public |
generatePerturbationMap(size: Number): DataTexture Generates a perturbation map. |
|
public |
getPerturbationMap(): Texture Returns the current perturbation map. |
|
public |
setPerturbationMap(perturbationMap: Texture) Replaces the current perturbation map with the given one. |
|
public |
Updates this effect. |
Inherited Summary
From class Effect | ||
public |
The effect attributes. |
|
public |
The blend mode of this effect. |
|
public |
Preprocessor macro definitions. |
|
public |
WebGL extensions that are required by this effect. |
|
public |
The fragment shader. |
|
public |
The name of this effect. |
|
public |
Shader uniforms. |
|
public |
The vertex shader. |
|
public |
dispose() Performs a shallow search for properties that define a dispose method and deletes them. |
|
public |
initialize(renderer: WebGLRenderer, alpha: Boolean) Performs initialization tasks. |
|
public |
setDepthTexture(depthTexture: Texture, depthPacking: Number) Sets the depth texture. |
|
public |
Updates the size of this effect. |
|
public |
Updates the effect by performing supporting operations. |
Public Constructors
public constructor(options: Object) source
Constructs a new glitch effect.
Override:
Effect#constructorParams:
Name | Type | Attribute | Description |
options | Object |
|
The options. |
options.blendFunction | BlendFunction |
|
The blend function of this effect. |
options.chromaticAberrationOffset | Vector2 |
|
A chromatic aberration offset. If provided, the glitch effect will influence this offset. |
options.delay | Vector2 |
|
The minimum and maximum delay between glitch activations in seconds. |
options.duration | Vector2 |
|
The minimum and maximum duration of a glitch in seconds. |
options.strength | Vector2 |
|
The strength of weak and strong glitches. |
options.perturbationMap | Texture |
|
A perturbation map. If none is provided, a noise texture will be created. |
options.dtSize | Number |
|
The size of the generated noise map. Will be ignored if a perturbation map is provided. |
options.columns | Number |
|
The scale of the blocky glitch columns. |
options.ratio | Number |
|
The threshold for strong glitches. |
Public Members
Public Methods
public generatePerturbationMap(size: Number): DataTexture source
Generates a perturbation map.
Params:
Name | Type | Attribute | Description |
size | Number |
|
The texture size. |
Return:
DataTexture | The perturbation map. |
public getPerturbationMap(): Texture source
Returns the current perturbation map.
Return:
Texture | The current perturbation map. |
public setPerturbationMap(perturbationMap: Texture) source
Replaces the current perturbation map with the given one.
The current map will be disposed if it was generated by this effect.
Params:
Name | Type | Attribute | Description |
perturbationMap | Texture | The new perturbation map. |
public update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number) source
Updates this effect.
Override:
Effect#updateParams:
Name | Type | Attribute | Description |
renderer | WebGLRenderer | The renderer. |
|
inputBuffer | WebGLRenderTarget | A frame buffer that contains the result of the previous pass. |
|
deltaTime | Number |
|
The time between the last frame and the current one in seconds. |