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

SMAAPass

Extends:

Pass → SMAAPass

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 pass.

Member Summary

Private Members
private

areaTexture: Texture

The SMAA area texture.

private

SMAA blend shader material.

private

A clear pass for the color edges buffer.

private

Color edge detection shader material.

private

renderTargetColorEdges: WebGLRenderTarget

A render target for the color edge detection.

private

renderTargetWeights: WebGLRenderTarget

A render target for the SMAA weights.

private

searchTexture: Texture

The SMAA search texture.

private

SMAA weights shader material.

Method Summary

Public Methods
public

render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, delta: Number, stencilTest: Boolean)

Renders the effect.

public

setSize(width: Number, height: Number)

Updates the size of this pass.

Inherited Summary

From class Pass
public get

material: Material

this get was deprecated. Use getFullscreenMaterial() instead.

The fullscreen material.

protected set

material: Material

this set was deprecated. Use setFullscreenMaterial(Material) instead.
public

[key]: *

public

Indicates whether this pass should be executed.

public

The name of this pass.

public

Indicates whether the EffectComposer should swap the frame buffers after this pass has finished rendering.

public

Indicates whether this pass should render to screen.

protected

camera: Camera

The camera.

protected

scene: Scene

The scene to render.

private

quad: Mesh

A quad mesh that fills the screen.

public

Performs a shallow search for disposable properties and deletes them.

public

getFullscreenMaterial(): Material

Returns the current fullscreen material.

public

initialize(renderer: WebGLRenderer, alpha: Boolean)

Performs initialization tasks.

public abstract

render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, delta: Number, stencilTest: Boolean)

Renders the effect.

public

setSize(width: Number, height: Number)

Updates this pass with the renderer's size.

You may override this method in case you want to be informed about the main render size.

The EffectComposer calls this method before this pass is initialized and every time its own size is updated.

protected

setFullscreenMaterial(material: Material)

Sets the fullscreen material.

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 SMAAPass.

Example:

const areaImage = new Image();
areaImage.addEventListener("load", progress);
areaImage.src = SMAAPass.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 SMAAPass.

Example:

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

Public Constructors

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

Constructs a new SMAA pass.

Override:

Pass#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 areaTexture: Texture source

The SMAA area texture.

private blendMaterial: SMAABlendMaterial source

SMAA blend shader material.

private clearPass: ClearPass source

A clear pass for the color edges buffer.

private colorEdgesMaterial: ColorEdgesMaterial source

Color edge detection shader material.

private renderTargetColorEdges: WebGLRenderTarget source

A render target for the color edge detection.

private renderTargetWeights: WebGLRenderTarget source

A render target for the SMAA weights.

private searchTexture: Texture source

The SMAA search texture.

private weightsMaterial: SMAAWeightsMaterial source

SMAA weights shader material.

Public Methods

public render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, delta: Number, stencilTest: Boolean) source

Renders the effect.

Override:

Pass#render

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

inputBuffer WebGLRenderTarget

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

outputBuffer WebGLRenderTarget

A frame buffer that serves as the output render target unless this pass renders to screen.

delta Number
  • optional

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

stencilTest Boolean
  • optional

Indicates whether a stencil mask is active.

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

Updates the size of this pass.

Override:

Pass#setSize

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.