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

ShaderPass

Extends:

Pass → ShaderPass

Indirect Implements:

A shader pass.

Renders any shader material as a fullscreen effect.

This pass should not be used to create multiple chained effects. For a more efficient solution, please refer to the EffectPass.

Constructor Summary

Public Constructor
public

constructor(material: ShaderMaterial, input: String)

Constructs a new shader pass.

Member Summary

Private Members
private

The input buffer uniform.

Method Summary

Public Methods
public

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

Renders the effect.

public

setInput(input: String)

Sets the name of the input buffer uniform.

Inherited Summary

From class Pass
public

[key]: *

public

Indicates whether this pass should be executed.

public

The name of this pass.

public

Indicates whether the EffectComposer should prepare a depth texture for 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

getDepthTexture(): Texture

Returns the current depth texture.

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

setDepthTexture(depthTexture: Texture, depthPacking: Number)

Sets the depth texture.

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.

Public Constructors

public constructor(material: ShaderMaterial, input: String) source

Constructs a new shader pass.

Override:

Pass#constructor

Params:

NameTypeAttributeDescription
material ShaderMaterial

A shader material.

input String
  • optional
  • default: "inputBuffer"

The name of the input buffer uniform.

Private Members

private uniform: String source

The input buffer uniform.

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 setInput(input: String) source

Sets the name of the input buffer uniform.

Most fullscreen materials modify texels from an input texture. This pass automatically assigns the main input buffer to the uniform identified by the given name.

Params:

NameTypeAttributeDescription
input String

The name of the input buffer uniform.