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

ToneMappingEffect

Extends:

three~EventDispatcherEffect → ToneMappingEffect

Indirect Implements:

A tone mapping effect that supports adaptive luminosity.

If adaptivity is enabled, this effect generates a texture that represents the luminosity of the current scene and adjusts it over time to simulate the optic nerve responding to the amount of light it is receiving.

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

The luminance adaptation rate.

public set
public get

Indicates whether this pass uses adaptive luminance.

public set

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 internal render targets.

Method Summary

Public Methods
public

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

Performs initialization tasks.

public

setSize(width: Number, height: Number)

Updates the size of internal render targets.

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.

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

Whether the tone mapping should use an adaptive luminance map.

options.resolution Number
  • optional
  • default: 256

The render texture resolution of the luminance map.

options.middleGrey Number
  • optional
  • default: 0.6

The middle grey factor.

options.maxLuminance Number
  • optional
  • default: 16.0

The maximum luminance.

options.averageLuminance Number
  • optional
  • default: 1.0

The average luminance.

options.adaptationRate Number
  • optional
  • default: 1.0

The luminance adaptation rate.

Public Members

public get adaptationRate: Number source

The luminance adaptation rate.

public set adaptationRate: Number source

public get adaptive: Boolean source

Indicates whether this pass uses adaptive luminance.

public set adaptive: Boolean source

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 internal render targets.

Public Methods

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 setSize(width: Number, height: Number) source

Updates the size of internal render targets.

Override:

Effect#setSize

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.

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.