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

ToneMappingEffect

Extends:

Effect → 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

The luminance distinction factor.

public set
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)

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 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 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.distinction Number
  • optional
  • default: 1.0

A luminance distinction factor.

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.

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

public get distinction: Number source

The luminance distinction factor.

public set distinction: Number source

public get resolution: Number source

The resolution of the render targets.

public set resolution: Number source

Sets the resolution of the internal render targets.

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

Public Methods

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

Performs initialization tasks.

Override:

Effect#initialize

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

alpha Boolean

Whether the renderer uses the alpha channel or not.

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.