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

LUTEffect

Extends:

three~EventDispatcherEffect → LUTEffect

Indirect Implements:

A LUT effect.

The tetrahedral interpolation algorithm was inspired by an implementation from OpenColorIO which is licensed under the BSD 3-Clause License.

The manual trilinear interpolation algorithm is based on an implementation by Garret Johnson which is licensed under the MIT License.

References: https://developer.nvidia.com/gpugems/gpugems2/part-iii-high-quality-rendering/chapter-24-using-lookup-tables-accelerate-color https://www.nvidia.com/content/GTC/posters/2010/V01-Real-Time-Color-Space-Conversion-for-High-Resolution-Video.pdf https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/master/src/OpenColorIO/ops/lut3d/ https://github.com/gkjohnson/threejs-sandbox/tree/master/3d-lut

Constructor Summary

Public Constructor
public

constructor(lut: Texture, options: Object)

Constructs a new color grading effect.

Method Summary

Public Methods
public

Returns the input encoding.

public

getLUT(): Texture

Returns the current LUT.

public

Returns the current output encoding.

public

Sets the input encoding.

public

setLUT(lut: Texture)

Sets the LUT.

public

Enables or disables tetrahedral interpolation.

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(lut: Texture, options: Object) source

Constructs a new color grading effect.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
lut Texture

The lookup texture.

options Object
  • optional

The options.

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

The blend function of this effect.

options.tetrahedralInterpolation Boolean
  • optional
  • default: false

Enables or disables tetrahedral interpolation.

Public Methods

public getInputEncoding(): Number source

Returns the input encoding.

This is set to sRGBEncoding by default since most LUTs expect sRGB input.

Return:

Number

The encoding.

public getLUT(): Texture source

Returns the current LUT.

Return:

Texture

The LUT.

public getOutputEncoding(): Number source

Returns the current output encoding.

Return:

Number

The encoding.

public setInputEncoding(value: Number) source

Sets the input encoding.

Set this to LinearEncoding if your LUT expects linear color input.

Params:

NameTypeAttributeDescription
value Number

The encoding.

public setLUT(lut: Texture) source

Sets the LUT.

Params:

NameTypeAttributeDescription
lut Texture

The LUT.

public setTetrahedralInterpolationEnabled(enabled: Boolean) source

Enables or disables tetrahedral interpolation. Requires a 3D LUT.

Tetrahedral interpolation produces highly accurate results, but is slower than hardware interpolation. This feature is disabled by default.

Params:

NameTypeAttributeDescription
enabled Boolean

Whether tetrahedral interpolation should be enabled.