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

Bokeh2Pass

Extends:

Pass → Bokeh2Pass

An advanced Depth of Field (DoF) pass.

Yields more realistic results but is also more demanding.

This pass requires a EffectComposer#depthTexture.

Constructor Summary

Public Constructor
public

constructor(camera: PerspectiveCamera, options: Object)

Constructs a new bokeh2 pass.

Member Summary

Public Members
public

The name of this pass.

public

This pass renders to the write buffer.

Private Members
private

A bokeh shader material.

Method Summary

Public Methods
public

render(renderer: WebGLRenderer, readBuffer: WebGLRenderTarget, writeBuffer: WebGLRenderTarget)

Renders the effect.

public

setSize(width: Number, height: Number)

Updates this pass with the renderer's size.

Inherited Summary

From class Pass
public

[key]: *

public

Enabled flag.

public

The name of this pass.

public

Indicates whether the read and write buffers should be swapped after this pass has finished rendering.

public

Render to screen flag.

protected

camera: Camera

The camera.

protected

quad: Mesh

A quad mesh that fills the screen.

protected

scene: Scene

The scene to render.

public

Performs a shallow search for properties that define a dispose method and deletes them.

public

initialise(renderer: WebGLRenderer, alpha: Boolean)

Performs initialisation tasks.

public abstract

render(renderer: WebGLRenderer, readBuffer: WebGLRenderTarget, writeBuffer: WebGLRenderTarget, delta: Number, maskActive: 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 initialised and every time its own size is updated.

Public Constructors

public constructor(camera: PerspectiveCamera, options: Object) source

Constructs a new bokeh2 pass.

Override:

Pass#constructor

Params:

NameTypeAttributeDescription
camera PerspectiveCamera

The main camera. Used to obtain the focal length and the near and far plane settings.

options Object
  • optional

Additional parameters.

options.rings Number
  • optional
  • default: 3

The amount of blur rings.

options.samples Number
  • optional
  • default: 4

The amount of samples per ring.

options.showFocus Boolean
  • optional
  • default: false

Whether the focus point should be highlighted.

options.manualDoF Boolean
  • optional
  • default: false

Enables manual depth of field blur.

options.vignette Boolean
  • optional
  • default: false

Enables a vignette effect.

options.pentagon Boolean
  • optional
  • default: false

Enable to use a pentagonal shape to scale gathered texels.

options.shaderFocus Boolean
  • optional
  • default: true

Disable if you compute your own focalDepth (in metres!).

options.noise Boolean
  • optional
  • default: true

Disable if you don't want noise patterns for dithering.

Public Members

public name: string source

The name of this pass.

Override:

Pass#name

public needsSwap: boolean source

This pass renders to the write buffer.

Override:

Pass#needsSwap

Private Members

private bokehMaterial: BokehMaterial source

A bokeh shader material.

Public Methods

public render(renderer: WebGLRenderer, readBuffer: WebGLRenderTarget, writeBuffer: WebGLRenderTarget) source

Renders the effect.

Override:

Pass#render

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

readBuffer WebGLRenderTarget

The read buffer.

writeBuffer WebGLRenderTarget

The write buffer.

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

Updates this pass with the renderer's size.

Override:

Pass#setSize

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.