Home Reference Source
import {ToneMappingEffect} from 'postprocessing'
public class | source

ToneMappingEffect

Extends:

three~EventDispatcherEffect → ToneMappingEffect

Indirect Implements:

A tone mapping effect.

Note: ToneMappingMode.REINHARD2_ADAPTIVE requires support for EXT_shader_texture_lod and EXT_color_buffer_half_float.

Reference: GDC2007 - Wolfgang Engel, Post-Processing Pipeline http://perso.univ-lyon1.fr/jean-claude.iehl/Public/educ/GAMA/2007/gdc07/Post-Processing_Pipeline.pdf

Constructor Summary

Public Constructor
public

constructor(options: Object)

Constructs a new tone mapping effect.

Member Summary

Public Members
public get
this get was deprecated. Use adaptiveLuminancePass.adaptationRate instead.

The luminance adaptation rate.

public set
this set was deprecated. Use adaptiveLuminancePass.adaptationRate instead.
public get
this get was deprecated. Use mode instead.

Indicates whether this pass uses adaptive luminance.

public set
this set was deprecated. Set mode to ToneMappingMode.REINHARD2_ADAPTIVE instead.

Enables or disables adaptive luminance.

public get
this get was deprecated.
public set
this set was deprecated.
public get

The resolution of the render targets.

public set

Sets the resolution of the luminance texture.

Method Summary

Public Methods
public

Returns the current tone mapping mode.

public

initialize(renderer: WebGLRenderer, alpha: Boolean, frameBufferType: Number)

Performs initialization tasks.

public

Sets the tone mapping mode.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number)

Updates this effect.

Inherited Summary

From class Effect
public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

WebGL extensions that are required by this effect.

public

The name of this effect.

public

uniforms: Map<String, Uniform>

Shader uniforms.

public

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

public

Returns the effect attributes.

public

Returns the fragment shader.

public

Returns the vertex shader.

public

initialize(renderer: WebGLRenderer, alpha: Boolean, frameBufferType: Number)

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.

protected

Sets the effect attributes.

protected

Informs the associated EffectPass that this effect has changed in a way that requires a shader recompilation.

protected

setFragmentShader(fragmentShader: String)

Sets the fragment shader.

protected

setVertexShader(vertexShader: String)

Sets the vertex shader.

Public Constructors

public constructor(options: Object) source

Constructs a new tone mapping effect.

The additional parameters only affect the Reinhard2 operator.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

The options.

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

The blend function of this effect.

options.adaptive Boolean
  • optional
  • default: true

Deprecated. Use mode instead.

options.mode ToneMappingMode
  • optional
  • default: ToneMappingMode.REINHARD2_ADAPTIVE

The tone mapping mode.

options.resolution Number
  • optional
  • default: 256

The resolution of the luminance texture. Must be a power of two.

options.maxLuminance Number
  • optional
  • default: 16.0

Deprecated. Same as whitePoint.

options.whitePoint Number
  • optional
  • default: 16.0

The white point.

options.middleGrey Number
  • optional
  • default: 0.6

The middle grey factor.

options.minLuminance Number
  • optional
  • default: 0.01

The minimum luminance. Prevents very high exposure in dark scenes.

options.averageLuminance Number
  • optional
  • default: 1.0

The average luminance. Used for the non-adaptive Reinhard operator.

options.adaptationRate Number
  • optional
  • default: 1.0

The luminance adaptation rate.

TODO:

  • Remove deprecated params and change default white point to 4.

Public Members

public get adaptationRate: Number source

this get was deprecated. Use adaptiveLuminancePass.adaptationRate instead.

The luminance adaptation rate.

public set adaptationRate: Number source

this set was deprecated. Use adaptiveLuminancePass.adaptationRate instead.

public get adaptive: Boolean source

this get was deprecated. Use mode instead.

Indicates whether this pass uses adaptive luminance.

public set adaptive: Boolean source

this set was deprecated. Set mode to ToneMappingMode.REINHARD2_ADAPTIVE instead.

Enables or disables adaptive luminance.

public get distinction: Number source

this get was deprecated.

public set distinction: Number source

this set was deprecated.

public get resolution: Number source

The resolution of the render targets.

public set resolution: Number source

Sets the resolution of the luminance texture. Must be a power of two.

Public Methods

public getMode(): ToneMappingMode source

Returns the current tone mapping mode.

Return:

ToneMappingMode

The tone mapping mode.

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

Performs initialization tasks.

Override:

Effect#initialize

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

alpha Boolean

Whether the renderer uses the alpha channel or not.

frameBufferType Number

The type of the main frame buffers.

public setMode(value: ToneMappingMode) source

Sets the tone mapping mode.

Params:

NameTypeAttributeDescription
value ToneMappingMode

The tone mapping mode.

public update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number) source

Updates this effect.

Override:

Effect#update

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

inputBuffer WebGLRenderTarget

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

deltaTime Number
  • optional

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