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

OutlinePass

Extends:

Pass → OutlinePass

Indirect Implements:

An outline pass.

Constructor Summary

Public Constructor
public

constructor(scene: Scene, camera: Camera, options: Object)

Constructs a new outline pass.

Member Summary

Public Members
public get

Indicates whether the effect should be applied to the input buffer.

public set

If disabled, the input buffer will remain unaffected.

public get

Indicates whether the outline overlay should be blurred.

public set
public set

If enabled, the result will be dithered to remove banding artifacts.

public get

Indicates whether dithering is enabled.

public get

The blur kernel size.

public set
public
public get

overlay: Texture

The effect overlay texture.

public

The pulse speed.

public get
this get was deprecated. Use getResolutionScale() instead.

The resolution scale.

public set
this set was deprecated. Use setResolutionScale(Number) instead.
public

A dedicated render layer for selected objects.

Private Members
private

A blur pass.

private

A copy pass that renders the read buffer to screen if needed.

private

mainCamera: Camera

The main camera.

private

mainScene: Scene

The main scene.

private

An outline blend material.

private

An outline edge detection material.

private

A depth pass.

private

A depth comparison mask pass.

private

renderTargetBlurredEdges: WebGLRenderTarget

A render target for the blurred outline overlay.

private

renderTargetDepth: WebGLRenderTarget

A render target for depth information.

private

renderTargetEdges: WebGLRenderTarget

A render target for the edge detection.

private

renderTargetMask: WebGLRenderTarget

A render target for the outline mask.

private

resolution: Vector2

The original resolution.

private

selection: Object3D[]

A list of objects to outline.

private

The current animation time.

Method Summary

Public Methods
public

Clears the list of selected objects.

public

deselectObject(object: Object3D): OutlinePass

Deselects an object.

public

Returns the current resolution scale.

public

initialize(renderer: WebGLRenderer, alpha: Boolean)

Performs initialization tasks.

public

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

Renders the effect.

public

selectObject(object: Object3D): OutlinePass

Selects an object.

public

setPatternTexture(texture: Texture)

Sets a pattern texture to use as an overlay for selected objects.

public

Sets the resolution scale.

public

setSelection(objects: Object3D[]): OutlinePass

Clears the current selection and selects a list of objects.

public

setSize(width: Number, height: Number)

Updates the size of this pass.

Private Methods
private

Sets the visibility of all selected objects.

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.

Public Constructors

public constructor(scene: Scene, camera: Camera, options: Object) source

Constructs a new outline pass.

Override:

Pass#constructor

Params:

NameTypeAttributeDescription
scene Scene

The main scene.

camera Camera

The main camera.

options Object
  • optional

Additional parameters. See BlurPass, OutlineBlendMaterial and OutlineEdgesMaterial for details.

options.pulseSpeed Number
  • optional
  • default: 0.0

The pulse speed. A value of zero disables the pulse effect.

options.blur Boolean
  • optional
  • default: true

Whether the outline should be blurred.

Public Members

public get blend: Boolean source

Indicates whether the effect should be applied to the input buffer.

public set blend: Boolean source

If disabled, the input buffer will remain unaffected.

You may use the BloomPass#overlay texture to apply the effect to your scene.

public get blur: Boolean source

Indicates whether the outline overlay should be blurred.

public set blur: Boolean source

public set dithering: Boolean source

If enabled, the result will be dithered to remove banding artifacts.

public get dithering: Boolean source

Indicates whether dithering is enabled.

public get kernelSize: KernelSize source

The blur kernel size.

public set kernelSize: KernelSize source

public needsSwap: * source

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

Set this to false if this pass doesn't render to the output buffer or the screen. Otherwise, the contents of the input buffer will be lost.

Override:

Pass#needsSwap

public get overlay: Texture source

The effect overlay texture.

public pulseSpeed: Number source

The pulse speed. A value of zero disables the pulse effect.

public get resolutionScale: Number source

this get was deprecated. Use getResolutionScale() instead.

The resolution scale.

public set resolutionScale: Number source

this set was deprecated. Use setResolutionScale(Number) instead.

public selectionLayer: Number source

A dedicated render layer for selected objects.

This layer is set to 10 by default. If this collides with your own custom layers, please change it to a free layer before rendering!

Private Members

private blurPass: BlurPass source

A blur pass.

private copyPass: ShaderPass source

A copy pass that renders the read buffer to screen if needed.

private mainCamera: Camera source

The main camera.

private mainScene: Scene source

The main scene.

private outlineBlendMaterial: OutlineBlendMaterial source

An outline blend material.

private outlineEdgesMaterial: OutlineEdgesMaterial source

An outline edge detection material.

private renderPassDepth: RenderPass source

A depth pass.

TODO:

  • Use multiple render targets in WebGL 2.0.

private renderPassMask: RenderPass source

A depth comparison mask pass.

TODO:

  • Use multiple render targets in WebGL 2.0.

private renderTargetBlurredEdges: WebGLRenderTarget source

A render target for the blurred outline overlay.

private renderTargetDepth: WebGLRenderTarget source

A render target for depth information.

private renderTargetEdges: WebGLRenderTarget source

A render target for the edge detection.

private renderTargetMask: WebGLRenderTarget source

A render target for the outline mask.

private resolution: Vector2 source

The original resolution.

private selection: Object3D[] source

A list of objects to outline.

private time: Number source

The current animation time.

Public Methods

public clearSelection(): OutlinePass source

Clears the list of selected objects.

Return:

OutlinePass

This pass.

public deselectObject(object: Object3D): OutlinePass source

Deselects an object.

Params:

NameTypeAttributeDescription
object Object3D

The object that should no longer be outlined.

Return:

OutlinePass

This pass.

public getResolutionScale(): Number source

Returns the current resolution scale.

Return:

Number

The resolution scale.

public initialize(renderer: WebGLRenderer, alpha: Boolean) source

Performs initialization tasks.

Override:

Pass#initialize

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

alpha Boolean

Whether the renderer uses the alpha channel or not.

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 selectObject(object: Object3D): OutlinePass source

Selects an object.

Params:

NameTypeAttributeDescription
object Object3D

The object that should be outlined.

Return:

OutlinePass

This pass.

public setPatternTexture(texture: Texture) source

Sets a pattern texture to use as an overlay for selected objects.

Params:

NameTypeAttributeDescription
texture Texture
  • optional
  • default: null

A pattern texture. Set to null to disable the pattern.

public setResolutionScale(scale: Number) source

Sets the resolution scale.

Params:

NameTypeAttributeDescription
scale Number

The new resolution scale.

public setSelection(objects: Object3D[]): OutlinePass source

Clears the current selection and selects a list of objects.

Params:

NameTypeAttributeDescription
objects Object3D[]

The objects that should be outlined. This array will be copied.

Return:

OutlinePass

This pass.

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.

Private Methods

private setSelectionVisible(visible: Boolean) source

Sets the visibility of all selected objects.

Params:

NameTypeAttributeDescription
visible Boolean

Whether the selected objects should be visible.