Home Reference Source
import {SMAAEffect} from 'postprocessing/src/effects/SMAAEffect.js'
public class | source

SMAAEffect

Extends:

Effect → SMAAEffect

Indirect Implements:

Subpixel Morphological Antialiasing (SMAA) v2.8.

Preset: SMAA 1x Medium (with color edge detection). https://github.com/iryoku/smaa/releases/tag/v2.8

Static Member Summary

Static Public Members
public static get

The SMAA area image, encoded as a base64 data URL.

public static get

The SMAA search image, encoded as a base64 data URL.

Constructor Summary

Public Constructor
public

constructor(searchImage: Image, areaImage: Image)

Constructs a new SMAA effect.

Member Summary

Private Members
private

A clear pass for the color edges buffer.

private

A color edge detection pass.

private

renderTargetColorEdges: WebGLRenderTarget

A render target for the color edge detection.

private

renderTargetWeights: WebGLRenderTarget

A render target for the SMAA weights.

private

An SMAA weights pass.

Method Summary

Public Methods
public

Sets the edge detection sensitivity.

public

Sets the maximum amount of horizontal/vertical search steps.

public

setSize(width: Number, height: Number)

Updates the size of internal render targets.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: Number)

Updates this effect.

Inherited Summary

From class Effect
public

[key]: *

public

The effect attributes.

public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

The fragment shader.

public

The name of this effect.

public

uniforms: Map<String, Uniform>

Shader uniforms.

public

The vertex shader.

public

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

setSize(width: Number, height: Number)

Updates the size of this effect.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: Number)

Updates the effect by performing supporting operations.

Static Public Members

public static get areaImageDataURL: String source

The SMAA area image, encoded as a base64 data URL.

Use this image data to create an Image instance and use it together with the search image to create an SMAAEffect.

Example:

const areaImage = new Image();
areaImage.addEventListener("load", progress);
areaImage.src = SMAAEffect.areaImageDataURL;

public static get searchImageDataURL: String source

The SMAA search image, encoded as a base64 data URL.

Use this image data to create an Image instance and use it together with the area image to create an SMAAEffect.

Example:

const searchImage = new Image();
searchImage.addEventListener("load", progress);
searchImage.src = SMAAEffect.searchImageDataURL;

Public Constructors

public constructor(searchImage: Image, areaImage: Image) source

Constructs a new SMAA effect.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
searchImage Image

The SMAA search image. Preload this image using the searchImageDataURL.

areaImage Image

The SMAA area image. Preload this image using the areaImageDataURL.

Private Members

private clearPass: ClearPass source

A clear pass for the color edges buffer.

private colorEdgesPass: ShaderPass source

A color edge detection pass.

private renderTargetColorEdges: WebGLRenderTarget source

A render target for the color edge detection.

private renderTargetWeights: WebGLRenderTarget source

A render target for the SMAA weights.

private weightsPass: ShaderPass source

An SMAA weights pass.

Public Methods

public setEdgeDetectionThreshold(threshold: Number) source

Sets the edge detection sensitivity.

See ColorEdgesMaterial#setEdgeDetectionThreshold for more details.

Params:

NameTypeAttributeDescription
threshold Number

The edge detection sensitivity. Range: [0.05, 0.5].

public setOrthogonalSearchSteps(steps: Number) source

Sets the maximum amount of horizontal/vertical search steps.

See SMAAWeightsMaterial#setOrthogonalSearchSteps for more details.

Params:

NameTypeAttributeDescription
steps Number

The search steps. Range: [0, 112].

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

Updates the size of internal render targets.

Override:

Effect#setSize

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.

public update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: Number) source

Updates this effect.

Override:

Effect#update

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

inputBuffer WebGLRenderTarget

A frame buffer that contains the result of the previous pass.

delta Number
  • optional

The time between the last frame and the current one in seconds.