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

RealisticBokehEffect

Extends:

Effect → RealisticBokehEffect

Indirect Implements:

Depth of Field shader v2.4.

Yields more realistic results but is also more demanding.

Original shader code by Martins Upitis: http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)

Constructor Summary

Public Constructor
public

constructor(options: Object)

Constructs a new bokeh effect.

Member Summary

Public Members
public get

Indicates whether the Depth of Field should be calculated manually.

public set

Enables or disables manual Depth of Field.

public get

Indicates whether the blur shape should be pentagonal.

public set

Enables or disables pentagonal blur.

public get

The amount of blur iterations.

public set

Sets the amount of blur iterations.

public get

The amount of blur samples per ring.

public set

Sets the amount of blur samples per ring.

public get

Indicates whether the focal point will be highlighted.

public set

Enables or disables focal point highlighting.

Inherited Summary

From class Effect
public

The effect attributes.

public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

WebGL extensions that are required by this effect.

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, deltaTime: Number)

Updates the effect by performing supporting operations.

Public Constructors

public constructor(options: Object) source

Constructs a new bokeh effect.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

The options.

options.blendFunction BlendFunction
  • optional
  • default: BlendFunction.NORMAL

The blend function of this effect.

options.focus Number
  • optional
  • default: 1.0

The focus distance in world units.

options.focalLength Number
  • optional
  • default: 24.0

The focal length of the main camera.

options.luminanceThreshold Number
  • optional
  • default: 0.5

A luminance threshold.

options.luminanceGain Number
  • optional
  • default: 2.0

A luminance gain factor.

options.bias Number
  • optional
  • default: 0.5

A blur bias.

options.fringe Number
  • optional
  • default: 0.7

A blur offset.

options.maxBlur Number
  • optional
  • default: 1.0

The maximum blur strength.

options.rings Boolean
  • optional
  • default: 3

The number of blur iterations.

options.samples Boolean
  • optional
  • default: 2

The amount of samples taken per ring.

options.showFocus Boolean
  • optional
  • default: false

Whether the focal point should be highlighted. Useful for debugging.

options.manualDoF Boolean
  • optional
  • default: false

Enables manual control over the depth of field.

options.pentagon Boolean
  • optional
  • default: false

Enables pentagonal blur shapes. Requires a high number of rings and samples.

Public Members

public get manualDoF: Boolean source

Indicates whether the Depth of Field should be calculated manually.

If enabled, the Depth of Field can be adjusted via the dof uniform.

public set manualDoF: Boolean source

Enables or disables manual Depth of Field.

You'll need to call EffectPass#recompile after changing this value.

public get pentagon: Boolean source

Indicates whether the blur shape should be pentagonal.

public set pentagon: Boolean source

Enables or disables pentagonal blur.

You'll need to call EffectPass#recompile after changing this value.

public get rings: Number source

The amount of blur iterations.

public set rings: Number source

Sets the amount of blur iterations.

You'll need to call EffectPass#recompile after changing this value.

public get samples: Number source

The amount of blur samples per ring.

public set samples: Number source

Sets the amount of blur samples per ring.

You'll need to call EffectPass#recompile after changing this value.

public get showFocus: Boolean source

Indicates whether the focal point will be highlighted.

public set showFocus: Boolean source

Enables or disables focal point highlighting.

You'll need to call EffectPass#recompile after changing this value.