UNPKG

postprocessing

Version:

A post processing library for three.js.

1,973 lines (1,879 loc) 252 kB
declare module "postprocessing" { import { Vector2, WebGLRenderer, Camera, PerspectiveCamera, Texture, Material, WebGLRenderTarget, Scene, Uniform, Object3D, Vector3, ShaderMaterial, DataTexture, Mesh, Points, Loader, DepthPackingStrategies, DepthModes, EventDispatcher, Color, ColorSpace, Data3DTexture, BaseEvent, CanvasTexture } from "three"; /** * Common events. */ export interface BaseEventMap { change: BaseEvent; } /** * A color channel enumeration. * * @type {Object} * @property {Number} RED - Red. * @property {Number} GREEN - Green. * @property {Number} BLUE - Blue. * @property {Number} ALPHA - Alpha. */ export enum ColorChannel { RED, GREEN, BLUE, ALPHA, } /** * The Disposable contract. * * Implemented by objects that can free internal resources. * * @interface */ export interface Disposable { /** * Frees internal resources. */ dispose(): void; } /** * The initializable contract. * * Implemented by objects that can be initialized. * * @interface */ export interface Initializable { /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - A renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize( renderer: WebGLRenderer, alpha: boolean, frameBufferType: number ): void; } /** * A Gauss kernel. * * Based on https://github.com/Jam3/glsl-fast-gaussian-blur. */ export class GaussKernel { /** * Constructs a new Gauss kernel. * * @param kernelSize - The kernel size. Should be an odd number in the range [3, 1020]. * @param [edgeBias=2] - Determines how many edge coefficients should be cut off for increased accuracy. */ constructor(kernelSize: number, edgeBias: number); } /** * An adaptive luminance shader material. */ export class AdaptiveLuminanceMaterial extends ShaderMaterial { /** * Constructs a new adaptive luminance material. */ constructor(); /** * The primary luminance buffer that contains the downsampled average luminance. * * @type {Texture} */ set luminanceBuffer0(arg: Texture); /** * Sets the primary luminance buffer that contains the downsampled average luminance. * * @deprecated Use luminanceBuffer0 instead. * @param {Texture} value - The buffer. */ setLuminanceBuffer0(value: Texture): void; /** * The secondary luminance buffer. * * @type {Texture} */ set luminanceBuffer1(arg: Texture); /** * Sets the secondary luminance buffer. * * @deprecated Use luminanceBuffer1 instead. * @param {Texture} value - The buffer. */ setLuminanceBuffer1(value: Texture): void; /** * The 1x1 mipmap level. * * This level is used to identify the smallest mipmap of the primary luminance buffer. * * @type {Number} */ set mipLevel1x1(arg: number); /** * Sets the 1x1 mipmap level. * * @deprecated Use mipLevel1x1 instead. * @param {Number} value - The level. */ setMipLevel1x1(value: number): void; /** * The delta time. * * @type {Number} */ set deltaTime(arg: number); /** * Sets the delta time. * * @deprecated Use deltaTime instead. * @param {Number} value - The delta time. */ setDeltaTime(value: number): void; set minLuminance(arg: number); /** * The lowest possible luminance value. * * @type {Number} */ get minLuminance(): number; /** * Returns the lowest possible luminance value. * * @deprecated Use minLuminance instead. * @return {Number} The minimum luminance. */ getMinLuminance(): number; /** * Sets the minimum luminance. * * @deprecated Use minLuminance instead. * @param {Number} value - The minimum luminance. */ setMinLuminance(value: number): void; set adaptationRate(arg: number); /** * The luminance adaptation rate. * * @type {Number} */ get adaptationRate(): number; /** * Returns the luminance adaptation rate. * * @deprecated Use adaptationRate instead. * @return {Number} The adaptation rate. */ getAdaptationRate(): number; /** * Sets the luminance adaptation rate. * * @deprecated Use adaptationRate instead. * @param {Number} value - The adaptation rate. */ setAdaptationRate(value: number): void; } /** * A bokeh disc blur material. * * This material should be applied twice in a row, with `fill` mode enabled for the second pass. Enabling the * `foreground` option causes the shader to combine the near and far CoC values around foreground objects. * * @implements {Resizable} */ export class BokehMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new bokeh material. * * @param {Boolean} [fill=false] - Enables or disables the bokeh highlight fill mode. * @param {Boolean} [foreground=false] - Determines whether this material will be applied to foreground colors. */ constructor(fill?: boolean, foreground?: boolean); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The buffer. */ setInputBuffer(value: Texture): void; /** * The circle of confusion buffer. * * @type {Texture} */ set cocBuffer(arg: Texture); /** * Sets the circle of confusion buffer. * * @deprecated Use cocBuffer instead. * @param {Texture} value - The buffer. */ setCoCBuffer(value: Texture): void; set scale(arg: number); /** * The blur scale. * * @type {Number} */ get scale(): number; /** * Returns the blur scale. * * @deprecated Use scale instead. * @return {Number} The scale. */ getScale(value: number): number; /** * Sets the blur scale. * * @deprecated Use scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * A Circle of Confusion shader material. */ export class CircleOfConfusionMaterial extends ShaderMaterial { /** * Constructs a new CoC material. * * @param {Camera} camera - A camera. */ constructor(camera: Camera); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; set focusDistance(arg: number); /** * The focus distance. Range: [0.0, 1.0]. * * @type {Number} */ get focusDistance(): number; /** * Returns the focus distance. * * @deprecated Use focusDistance instead. * @return {Number} The focus distance. */ getFocusDistance(value: number): number; /** * Sets the focus distance. * * @deprecated Use focusDistance instead. * @param {Number} value - The focus distance. */ setFocusDistance(value: number): void; set focalLength(arg: number); /** * The focal length. * * @deprecated Renamed to focusRange. * @type {Number} */ get focalLength(): number; /** * Returns the focal length. * * @deprecated Use focusRange instead. * @return {Number} The focal length. */ getFocalLength(value: number): number; /** * Sets the focal length. * * @deprecated Use focusRange instead. * @param {Number} value - The focal length. */ setFocalLength(value: number): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; /** * The focus distance in world units. * * @type {Number} */ get worldFocusDistance(): number; set worldFocusDistance(value: number); /** * The focus range. Range: [0.0, 1.0]. * * @type {Number} */ get focusRange(): number; set focusRange(value: number); /** * The focus range in world units. * * @type {Number} */ get worldFocusRange(): number; set worldFocusRange(value: number); } /** * A blur kernel size enumeration. * * @type {Object} * @property {Number} VERY_SMALL - A very small kernel that matches a 7x7 Gaussian blur kernel. * @property {Number} SMALL - A small kernel that matches a 15x15 Gaussian blur kernel. * @property {Number} MEDIUM - A medium sized kernel that matches a 23x23 Gaussian blur kernel. * @property {Number} LARGE - A large kernel that matches a 35x35 Gaussian blur kernel. * @property {Number} VERY_LARGE - A very large kernel that matches a 63x63 Gaussian blur kernel. * @property {Number} HUGE - A huge kernel that matches a 127x127 Gaussian blur kernel. */ export enum KernelSize { VERY_SMALL, SMALL, MEDIUM, LARGE, VERY_LARGE, HUGE, } /** * A simple copy shader material. */ export class CopyMaterial extends ShaderMaterial { /** * Constructs a new copy material. */ constructor(); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Number} value - The buffer. */ setInputBuffer(value: number): void; /** * Returns the opacity. * * @deprecated Use opacity instead. * @return {Number} The opacity. */ getOpacity(): number; /** * Sets the opacity. * * @deprecated Use opacity instead. * @param {Number} value - The opacity. */ setOpacity(value: number): void; } /** * A depth comparison shader material. */ export class DepthComparisonMaterial extends ShaderMaterial { /** * Constructs a new depth comparison material. * * @param {Texture} [depthTexture=null] - A depth texture. * @param {PerspectiveCamera} [camera] - A camera. */ constructor(depthTexture?: Texture, camera?: PerspectiveCamera); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=RGBADepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; } /** * An enumeration of depth copy modes. * * @type {Object} * @property {Number} FULL - Copies the full depth texture every frame. * @property {Number} SINGLE - Copies a single texel from the depth texture on demand. */ export enum DepthCopyMode { FULL, SINGLE, } /** * A depth copy shader material. */ export class DepthCopyMaterial extends ShaderMaterial { /** * Constructs a new depth copy material. */ constructor(); /** * The input depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The input depth packing strategy. * * @type {DepthPackingStrategies} */ set inputDepthPacking(arg: DepthPackingStrategies); set outputDepthPacking(arg: DepthPackingStrategies); /** * The output depth packing strategy. * * @type {DepthPackingStrategies} */ get outputDepthPacking(): DepthPackingStrategies; /** * Sets the input depth buffer. * * @deprecated Use depthBuffer and inputDepthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Returns the current input depth packing strategy. * * @deprecated * @return {DepthPackingStrategies} The input depth packing strategy. */ getInputDepthPacking(): DepthPackingStrategies; /** * Sets the input depth packing strategy. * * @deprecated Use inputDepthPacking instead. * @param {DepthPackingStrategies} value - The new input depth packing strategy. */ setInputDepthPacking(value: DepthPackingStrategies): void; /** * Returns the current output depth packing strategy. * * @deprecated Use outputDepthPacking instead. * @return {DepthPackingStrategies} The output depth packing strategy. */ getOutputDepthPacking(): DepthPackingStrategies; /** * Sets the output depth packing strategy. * * @deprecated Use outputDepthPacking instead. * @param {DepthPackingStrategies} value - The new output depth packing strategy. */ setOutputDepthPacking(value: DepthPackingStrategies): void; /** * The screen space position used for single-texel copy operations. * * @type {Vector2} */ get texelPosition(): Vector2; /** * Returns the screen space position used for single-texel copy operations. * * @deprecated Use texelPosition instead. * @return {Vector2} The position. */ getTexelPosition(): Vector2; /** * Sets the screen space position used for single-texel copy operations. * * @deprecated * @param {Vector2} value - The position. */ setTexelPosition(value: Vector2): void; set mode(arg: DepthCopyMode); /** * The depth copy mode. * * @type {DepthCopyMode} */ get mode(): DepthCopyMode; /** * Returns the depth copy mode. * * @deprecated Use mode instead. * @return {DepthCopyMode} The depth copy mode. */ getMode(): DepthCopyMode; /** * Sets the depth copy mode. * * @deprecated Use mode instead. * @param {DepthCopyMode} value - The new mode. */ setMode(value: DepthCopyMode): void; } /** * A depth downsampling shader material. * * Based on an article by Eleni Maria Stea: * https://eleni.mutantstargoat.com/hikiko/depth-aware-upsampling-6 * * @implements {Resizable} */ export class DepthDownsamplingMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new depth downsampling material. */ constructor(); /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * The normal buffer. * * @type {Texture} */ set normalBuffer(arg: Texture); /** * Sets the normal buffer. * * @deprecated Use normalBuffer instead. * @param {Texture} value - The normal buffer. */ setNormalBuffer(value: Texture): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * An enumeration of depth test strategies. * * @type {Object} * @property {Number} DEFAULT - Perform depth test only. * @property {Number} KEEP_MAX_DEPTH - Always keep max depth. * @property {Number} DISCARD_MAX_DEPTH - Always discard max depth. */ export enum DepthTestStrategy { DEFAULT, KEEP_MAX_DEPTH, DISCARD_MAX_DEPTH, } /** * A depth mask shader material. * * This material masks a color buffer by comparing two depth textures. */ export class DepthMaskMaterial extends ShaderMaterial { /** * Constructs a new depth mask material. */ constructor(); set depthMode(arg: DepthModes); /** * The depth mode. * * @see https://threejs.org/docs/#api/en/constants/Materials * @type {DepthModes} */ get depthMode(): DepthModes; /** * The primary depth buffer. * * @type {Texture} */ set depthBuffer0(arg: Texture); /** * The primary depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking0(arg: DepthPackingStrategies); /** * Sets the base depth buffer. * * @deprecated Use depthBuffer0 and depthPacking0 instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer0( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * The secondary depth buffer. * * @type {Texture} */ set depthBuffer1(arg: Texture); /** * The secondary depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking1(arg: DepthPackingStrategies); /** * Sets the depth buffer that will be compared with the base depth buffer. * * @deprecated Use depthBuffer1 and depthPacking1 instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer1( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; set maxDepthStrategy(arg: DepthTestStrategy); /** * The strategy for handling maximum depth. * * @type {DepthTestStrategy} */ get maxDepthStrategy(): DepthTestStrategy; set keepFar(arg: boolean); /** * Indicates whether maximum depth values should be preserved. * * @type {Boolean} * @deprecated Use maxDepthStrategy instead. */ get keepFar(): boolean; /** * Returns the strategy for dealing with maximum depth values. * * @deprecated Use maxDepthStrategy instead. * @return {DepthTestStrategy} The strategy. */ getMaxDepthStrategy(): DepthTestStrategy; /** * Sets the strategy for dealing with maximum depth values. * * @deprecated Use maxDepthStrategy instead. * @param {DepthTestStrategy} value - The strategy. */ setMaxDepthStrategy(value: DepthTestStrategy): void; set epsilon(arg: number); /** * A small error threshold that is used for `EqualDepth` and `NotEqualDepth` tests. Default is `1e-5`. * * @type {Number} */ get epsilon(): number; /** * Returns the current error threshold for depth comparisons. Default is `1e-5`. * * @deprecated Use epsilon instead. * @return {Number} The error threshold. */ getEpsilon(): number; /** * Sets the depth comparison error threshold. * * @deprecated Use epsilon instead. * @param {Number} value - The new error threshold. */ setEpsilon(value: number): void; /** * Returns the current depth mode. * * @deprecated Use depthMode instead. * @return {DepthModes} The depth mode. Default is `LessDepth`. */ getDepthMode(): DepthModes; /** * Sets the depth mode. * * @deprecated Use depthMode instead. * @param {DepthModes} mode - The depth mode. */ setDepthMode(mode: DepthModes): void; } /** * An enumeration of edge detection modes. * * @type {Object} * @property {Number} DEPTH - Depth-based edge detection. * @property {Number} LUMA - Luminance-based edge detection. * @property {Number} COLOR - Chroma-based edge detection. */ export enum EdgeDetectionMode { DEPTH, LUMA, COLOR, } /** * An enumeration of predication modes. * * @type {Object} * @property {Number} DISABLED - No predicated thresholding. * @property {Number} DEPTH - Depth-based predicated thresholding. * @property {Number} CUSTOM - Predicated thresholding using a custom buffer. */ export enum PredicationMode { DISABLED, DEPTH, CUSTOM, } /** * An edge detection material. * * Mainly used for Subpixel Morphological Anti-Aliasing. * * @implements {Resizable} */ export class EdgeDetectionMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new edge detection material. * * TODO Remove parameters. * @param {Vector2} [texelSize] - The screen texel size. * @param {EdgeDetectionMode} [mode=EdgeDetectionMode.COLOR] - The edge detection mode. */ constructor(texelSize?: Vector2, mode?: EdgeDetectionMode); set edgeDetectionMode(arg: EdgeDetectionMode); /** * The edge detection mode. * * @type {EdgeDetectionMode} */ get edgeDetectionMode(): EdgeDetectionMode; /** * The depth buffer. * * @type {Texture} */ set depthBuffer(arg: Texture); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ set depthPacking(arg: DepthPackingStrategies); /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Returns the edge detection mode. * * @deprecated Use edgeDetectionMode instead. * @return {EdgeDetectionMode} The mode. */ getEdgeDetectionMode(): EdgeDetectionMode; /** * Sets the edge detection mode. * * @deprecated Use edgeDetectionMode instead. * @param {EdgeDetectionMode} value - The edge detection mode. */ setEdgeDetectionMode(value: EdgeDetectionMode): void; set localContrastAdaptationFactor(arg: number); /** * The local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH. Default is 2.0. * * If a neighbor edge has _factor_ times bigger contrast than the current edge, the edge will be discarded. * * This allows to eliminate spurious crossing edges and is based on the fact that if there is too much contrast in a * direction, the perceptual contrast in the other neighbors will be hidden. * * @type {Number} */ get localContrastAdaptationFactor(): number; /** * Returns the local contrast adaptation factor. * * @deprecated Use localContrastAdaptationFactor instead. * @return {Number} The factor. */ getLocalContrastAdaptationFactor(): number; /** * Sets the local contrast adaptation factor. Has no effect if the edge detection mode is set to DEPTH. * * @deprecated Use localContrastAdaptationFactor instead. * @param {Number} value - The local contrast adaptation factor. Default is 2.0. */ setLocalContrastAdaptationFactor(value: number): void; set edgeDetectionThreshold(arg: number); /** * The edge detection threshold. Range: [0.0, 0.5]. * * A lower value results in more edges being detected at the expense of performance. * * For luma- and chroma-based edge detection, 0.1 is a reasonable value and allows to catch most visible edges. 0.05 * is a rather overkill value that allows to catch 'em all. Darker scenes may require an even lower threshold. * * If depth-based edge detection is used, the threshold will depend on the scene depth. * * @type {Number} */ get edgeDetectionThreshold(): number; /** * Returns the edge detection threshold. * * @deprecated Use edgeDetectionThreshold instead. * @return {Number} The threshold. */ getEdgeDetectionThreshold(): number; /** * Sets the edge detection threshold. * * @deprecated Use edgeDetectionThreshold instead. * @param {Number} value - The edge detection threshold. Range: [0.0, 0.5]. */ setEdgeDetectionThreshold(value: number): void; set predicationMode(arg: PredicationMode); /** * The predication mode. * * Predicated thresholding allows to better preserve texture details and to improve edge detection using an additional * buffer such as a light accumulation or depth buffer. * * @type {PredicationMode} */ get predicationMode(): PredicationMode; /** * Returns the predication mode. * * @deprecated Use predicationMode instead. * @return {PredicationMode} The mode. */ getPredicationMode(): PredicationMode; /** * Sets the predication mode. * * @deprecated Use predicationMode instead. * @param {PredicationMode} value - The predication mode. */ setPredicationMode(value: PredicationMode): void; /** * The predication buffer. * * @type {Texture} */ set predicationBuffer(arg: Texture); /** * Sets a custom predication buffer. * * @deprecated Use predicationBuffer instead. * @param {Texture} value - The predication buffer. */ setPredicationBuffer(value: Texture): void; set predicationThreshold(arg: number); /** * The predication threshold. * * @type {Number} */ get predicationThreshold(): number; /** * Returns the predication threshold. * * @deprecated Use predicationThreshold instead. * @return {Number} The threshold. */ getPredicationThreshold(): number; /** * Sets the predication threshold. * * @deprecated Use predicationThreshold instead. * @param {Number} value - The threshold. */ setPredicationThreshold(value: number): void; set predicationScale(arg: number); /** * The predication scale. Range: [1.0, 5.0]. * * Determines how much the edge detection threshold should be scaled when using predication. * * @type {Number} */ get predicationScale(): number; /** * Returns the predication scale. * * @deprecated Use predicationScale instead. * @return {Number} The scale. */ getPredicationScale(): number; /** * Sets the predication scale. * * @deprecated Use predicationScale instead. * @param {Number} value - The scale. Range: [1.0, 5.0]. */ setPredicationScale(value: number): void; set predicationStrength(arg: number); /** * The predication strength. Range: [0.0, 1.0]. * * Determines how much the edge detection threshold should be decreased locally when using predication. * * @type {Number} */ get predicationStrength(): number; /** * Returns the predication strength. * * @deprecated Use predicationStrength instead. * @return {Number} The strength. */ getPredicationStrength(): number; /** * Sets the predication strength. * * @deprecated Use predicationStrength instead. * @param {Number} value - The strength. Range: [0.0, 1.0]. */ setPredicationStrength(value: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } export type ColorEdgesMaterial = EdgeDetectionMaterial; /** * An effect material for compound shaders. Supports dithering. * * @implements {Resizable} */ export class EffectMaterial extends ShaderMaterial implements Resizable { /** * An enumeration of shader code section placeholders used by the {@link EffectPass}. * * @type {Object} * @property {String} FRAGMENT_HEAD - A placeholder for function and variable declarations inside the fragment shader. * @property {String} FRAGMENT_MAIN_UV - A placeholder for UV transformations inside the fragment shader. * @property {String} FRAGMENT_MAIN_IMAGE - A placeholder for color calculations inside the fragment shader. * @property {String} VERTEX_HEAD - A placeholder for function and variable declarations inside the vertex shader. * @property {String} VERTEX_MAIN_SUPPORT - A placeholder for supporting calculations inside the vertex shader. */ static get Section(): { FRAGMENT_HEAD: string; FRAGMENT_MAIN_UV: string; FRAGMENT_MAIN_IMAGE: string; VERTEX_HEAD: string; VERTEX_MAIN_SUPPORT: string; }; /** * Constructs a new effect material. * * @param {Map<String, String>} [shaderParts] - A collection of shader snippets. See {@link Section}. * @param {Map<String, String>} [defines] - A collection of preprocessor macro definitions. * @param {Map<String, Uniform>} [uniforms] - A collection of uniforms. * @param {Camera} [camera] - A camera. * @param {Boolean} [dithering=false] - Whether dithering should be enabled. */ constructor( shaderParts?: Map<string, string>, defines?: Map<string, string>, uniforms?: Map<string, Uniform>, camera?: Camera, dithering?: boolean ); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set depthBuffer(arg: Texture); /** * The depth buffer. * * @type {Texture} */ get depthBuffer(): Texture; set depthPacking(arg: DepthPackingStrategies); /** * The depth packing strategy. * * @type {DepthPackingStrategies} */ get depthPacking(): DepthPackingStrategies; /** * Sets the depth buffer. * * @deprecated Use depthBuffer and depthPacking instead. * @param {Texture} buffer - The depth texture. * @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy. */ setDepthBuffer( buffer: Texture, depthPacking?: DepthPackingStrategies ): void; /** * Sets the shader parts. * * @param {Map<String, String>} shaderParts - A collection of shader snippets. See {@link Section}. * @return {EffectMaterial} This material. */ setShaderParts(shaderParts: Map<string, string>): EffectMaterial; /** * Sets the shader macros. * * @param {Map<String, String>} defines - A collection of preprocessor macro definitions. * @return {EffectMaterial} This material. */ setDefines(defines: Map<string, string>): EffectMaterial; /** * Sets the shader uniforms. * * @param {Map<String, Uniform>} uniforms - A collection of uniforms. * @return {EffectMaterial} This material. */ setUniforms(uniforms: Map<string, Uniform>): EffectMaterial; /** * Sets the required shader extensions. * * @param {Set<WebGLExtension>} extensions - A collection of extensions. * @return {EffectMaterial} This material. */ setExtensions(extensions: Set<WebGLExtension>): EffectMaterial; set encodeOutput(arg: boolean); /** * Indicates whether output encoding is enabled. * * @type {Boolean} */ get encodeOutput(): boolean; /** * Indicates whether output encoding is enabled. * * @deprecated Use encodeOutput instead. * @return {Boolean} Whether output encoding is enabled. */ isOutputEncodingEnabled(): boolean; /** * Enables or disables output encoding. * * @deprecated Use encodeOutput instead. * @param {Boolean} value - Whether output encoding should be enabled. */ setOutputEncodingEnabled(value: boolean): void; set time(arg: number); /** * The time in seconds. * * @type {Number} */ get time(): number; /** * Sets the delta time. * * @deprecated Use time instead. * @param {Number} value - The delta time in seconds. */ setDeltaTime(value: number): void; /** * Adopts the settings of the given camera. * * @param {Camera} camera - A camera. */ adoptCameraSettings(camera: Camera): void; /** * Sets the resolution. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } /** * An enumeration of shader code placeholders used by the {@link EffectPass}. * @property FRAGMENT_HEAD - A placeholder for function and variable declarations inside the fragment shader. * @property FRAGMENT_MAIN_UV - A placeholder for UV transformations inside the fragment shader. * @property FRAGMENT_MAIN_IMAGE - A placeholder for color calculations inside the fragment shader. * @property VERTEX_HEAD - A placeholder for function and variable declarations inside the vertex shader. * @property VERTEX_MAIN_SUPPORT - A placeholder for supporting calculations inside the vertex shader. * @deprecated Use EffectMaterial.Section instead. */ export const Section: { FRAGMENT_HEAD: string; FRAGMENT_MAIN_UV: string; FRAGMENT_MAIN_IMAGE: string; VERTEX_HEAD: string; VERTEX_MAIN_SUPPORT: string; }; /** * A crepuscular rays shader material. * * References: * * Thibaut Despoulain, 2012: * [(WebGL) Volumetric Light Approximation in Three.js]( * http://bkcore.com/blog/3d/webgl-three-js-volumetric-light-godrays.html) * * Nvidia, GPU Gems 3, 2008: * [Chapter 13. Volumetric Light Scattering as a Post-Process]( * https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch13.html) * * @todo Remove dithering code from fragment shader. */ export class GodRaysMaterial extends ShaderMaterial { /** * Constructs a new god rays material. * * TODO Remove lightPosition param. * @param {Vector2} lightPosition - Deprecated. */ constructor(lightPosition: Vector2); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; /** * The screen space position of the light source. * * @type {Vector2} */ get lightPosition(): Vector2; /** * Returns the screen space position of the light source. * * @deprecated Use lightPosition instead. * @return {Vector2} The position. */ getLightPosition(): Vector2; /** * Sets the screen space position of the light source. * * @deprecated Use lightPosition instead. * @param {Vector2} value - The position. */ setLightPosition(value: Vector2): void; set density(arg: number); /** * The density. * * @type {Number} */ get density(): number; /** * Returns the density. * * @deprecated Use density instead. * @return {Number} The density. */ getDensity(): number; /** * Sets the density. * * @deprecated Use density instead. * @param {Number} value - The density. */ setDensity(value: number): void; set decay(arg: number); /** * The decay. * * @type {Number} */ get decay(): number; /** * Returns the decay. * * @deprecated Use decay instead. * @return {Number} The decay. */ getDecay(): number; /** * Sets the decay. * * @deprecated Use decay instead. * @param {Number} value - The decay. */ setDecay(value: number): void; set weight(arg: number); /** * The weight. * * @type {Number} */ get weight(): number; /** * Returns the weight. * * @deprecated Use weight instead. * @return {Number} The weight. */ getWeight(): number; /** * Sets the weight. * * @deprecated Use weight instead. * @param {Number} value - The weight. */ setWeight(value: number): void; set exposure(arg: number); /** * The exposure. * * @type {Number} */ get exposure(): number; /** * Returns the exposure. * * @deprecated Use exposure instead. * @return {Number} The exposure. */ getExposure(): number; /** * Sets the exposure. * * @deprecated Use exposure instead. * @param {Number} value - The exposure. */ setExposure(value: number): void; set maxIntensity(arg: number); /** * The maximum light intensity. * * @type {Number} */ get maxIntensity(): number; /** * Returns the maximum light intensity. * * @deprecated Use maxIntensity instead. * @return {Number} The maximum light intensity. */ getMaxIntensity(): number; /** * Sets the maximum light intensity. * * @deprecated Use maxIntensity instead. * @param {Number} value - The maximum light intensity. */ setMaxIntensity(value: number): void; set samples(arg: number); /** * The amount of samples per pixel. * * @type {Number} */ get samples(): number; /** * Returns the amount of samples per pixel. * * @deprecated Use samples instead. * @return {Number} The sample count. */ getSamples(): number; /** * Sets the amount of samples per pixel. * * @deprecated Use samples instead. * @param {Number} value - The sample count. */ setSamples(value: number): void; } /** * A box blur material. * * @implements {Resizable} */ export class BoxBlurMaterial extends ShaderMaterial {} /** * A box blur pass. */ export class BoxBlurPass extends Pass { /** * Constructs a new box blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=5] - The kernel size. * @param {Number} [options.iterations=1] - The amount of times the blur should be applied. * @param {Number} [options.bilateral=false] - Enables or disables bilateral blurring. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. */ constructor( { kernelSize, iterations, bilateral, resolutionScale, resolutionX, resolutionY }?: { kernelSize?: number; iterations?: number; bilateral?: boolean; resolutionScale?: number; resolutionX?: number; resolutionY?: number; } ); } /** * An optimized Gaussian convolution shader material. * * References: * * Filip Strugar, Intel, 2014: [An investigation of fast real-time GPU-based image blur algorithms]( * https://www.intel.com/content/www/us/en/developer/articles/technical/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms.html) * * @implements {Resizable} */ export class GaussianBlurMaterial extends ShaderMaterial { /** * Constructs a new convolution material. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=35] - The kernel size. */ constructor( { kernelSize }?: { kernelSize?: number; } ); } /** * A Gaussian blur pass. */ export class GaussianBlurPass extends Pass { /** * Constructs a new Gaussian blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.kernelSize=35] - The kernel size. Should be an odd number in the range [3, 1020]. * @param {Number} [options.iterations=1] - The amount of times the blur should be applied. * @param {Number} [options.resolutionScale=1.0] - The resolution scale. * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution. * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution. */ constructor( { kernelSize, iterations, resolutionScale, resolutionX, resolutionY }?: { kernelSize?: number; iterations?: number; resolutionScale?: number; resolutionX?: number; resolutionY?: number; } ); } /** * An optimised convolution shader material. * * Based on the GDC2003 Presentation by Masaki Kawase, Bunkasha Games: * Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless) * and an article by Filip Strugar, Intel: * An investigation of fast real-time GPU-based image blur algorithms * * Further modified according to Apple's [Best Practices for Shaders](https://goo.gl/lmRoM5). * * @todo Remove dithering code from fragment shader. * @implements {Resizable} */ export class KawaseBlurMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new convolution material. * * TODO Remove texelSize param. * @param {Vector2} [texelSize] - Deprecated. */ constructor(texelSize?: Vector2); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set scale(arg: number); /** * The blur scale. * * @type {Number} */ get scale(): number; /** * Returns the blur scale. * * @deprecated Use scale instead. * @return {Number} The scale. */ getScale(): number; /** * Sets the blur scale. * * @deprecated Use scale instead. * @param {Number} value - The scale. */ setScale(value: number): void; /** * Returns the kernel. * * @return {Float32Array} The kernel. * @deprecated Implementation detail, removed with no replacement. */ getKernel(): Float32Array; set kernel(arg: number); /** * The current kernel. * * @type {Number} */ get kernel(): number; /** * Sets the current kernel. * * @deprecated Use kernel instead. * @param {Number} value - The kernel. */ setKernel(value: number): void; /** * Sets the texel size. * * @deprecated Use setSize() instead. * @param {Number} x - The texel width. * @param {Number} y - The texel height. */ setTexelSize(x: number, y: number): void; /** * Sets the size of this object. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width: number, height: number): void; } export type ConvolutionMaterial = KawaseBlurMaterial; /** * A luminance shader material. * * This shader produces a greyscale luminance map that describes the absolute amount of light emitted by a scene. It can * also be configured to output colors that are scaled with their respective luminance value. Additionally, a range may * be provided to mask out undesired texels. * * The alpha channel always contains the luminance value. * * On luminance coefficients: * http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9 * * Coefficients for different color spaces: * https://hsto.org/getpro/habr/post_images/2ab/69d/084/2ab69d084f9a597e032624bcd74d57a7.png * * Luminance range reference: * https://cycling74.com/2007/05/23/your-first-shader/#.Vty9FfkrL4Z */ export class LuminanceMaterial extends ShaderMaterial { /** * Constructs a new luminance material. * * @param {Boolean} [colorOutput=false] - Defines whether the shader should output colors scaled with their luminance value. * @param {Vector2} [luminanceRange] - If provided, the shader will mask out texels that aren't in the specified luminance range. */ constructor(colorOutput?: boolean, luminanceRange?: Vector2); set colorOutput(arg: boolean); /** * Indicates whether color output is enabled. * * @type {Boolean} */ get colorOutput(): boolean; set luminanceRange(arg: boolean); /** * The luminance range. Set to null to disable. * * @type {Boolean} */ get luminanceRange(): boolean; /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; set threshold(arg: number); /** * The luminance threshold. * * @type {Number} */ get threshold(): number; /** * Returns the luminance threshold. * * @deprecated Use threshold instead. * @return {Number} The threshold. */ getThreshold(): number; /** * Sets the luminance threshold. * * @deprecated Use threshold instead. * @param {Number} value - The threshold. */ setThreshold(value: number): void; set smoothing(arg: number); /** * The luminance threshold smoothing. * * @type {Number} */ get smoothing(): number; /** * Returns the luminance threshold smoothing factor. * * @deprecated Use smoothing instead. * @return {Number} The smoothing factor. */ getSmoothingFactor(): number; /** * Sets the luminance threshold smoothing factor. * * @deprecated Use smoothing instead. * @param {Number} value - The smoothing factor. */ setSmoothingFactor(value: number): void; set useThreshold(arg: boolean); /** * Indicates whether the luminance threshold is enabled. * * @type {Boolean} * @deprecated Adjust the threshold or smoothing factor instead. */ get useThreshold(): boolean; /** * Indicates whether color output is enabled. * * @deprecated Use colorOutput instead. * @return {Boolean} Whether color output is enabled. */ isColorOutputEnabled(): boolean; /** * Enables or disables color output. * * @deprecated Use colorOutput instead. * @param {Boolean} value - Whether color output should be enabled. */ setColorOutputEnabled(value: boolean): void; set useRange(arg: boolean); /** * Indicates whether luminance masking is enabled. * * @type {Boolean} * @deprecated */ get useRange(): boolean; /** * Returns the current luminance range. * * @deprecated Use luminanceRange instead. * @return {Vector2} The luminance range. */ getLuminanceRange(): Vector2; /** * Sets a luminance range. Set to null to disable. * * @deprecated Use luminanceRange instead. * @param {Vector2} value - The luminance range. */ setLuminanceRange(value: Vector2): void; } /** * A mask function enumeration. * * @type {Object} * @property {Number} DISCARD - Discards elements when the respective mask value is zero. * @property {Number} MULTIPLY - Multiplies the input buffer with the mask texture. * @property {Number} MULTIPLY_RGB_SET_ALPHA - Multiplies the input RGB values with the mask and sets alpha to the mask value. * @property {Number} MULTIPLY_RGB - Multiplies the input RGB values with the mask and keeps the original alpha. */ export enum MaskFunction { DISCARD, MULTIPLY, MULTIPLY_RGB_SET_ALPHA, MULTIPLY_RGB } /** * A mask shader material. * * This material applies a mask texture to a buffer. */ export class MaskMaterial extends ShaderMaterial { /** * Constructs a new mask material. * * @param {Texture} [maskTexture] - The mask texture. */ constructor(maskTexture?: Texture); /** * The input buffer. * * @type {Texture} */ set inputBuffer(arg: Texture); /** * Sets the input buffer. * * @deprecated Use inputBuffer instead. * @param {Texture} value - The input buffer. */ setInputBuffer(value: Texture): void; /** * The mask texture. * * @type {Texture} */ set maskTexture(arg: Texture); /** * Sets the mask texture. * * @deprecated Use maskTexture instead. * @param {Texture} value - The texture. */ setMaskTexture(value: Texture): void; /** * Sets the color channel to use for masking. Default is `ColorChannel.RED`. * * @type {ColorChannel} */ set colorChannel(arg: ColorChannel); /** * Sets the color channel to use for masking. Default is `ColorChannel.RED`. * * @deprecated Use colorChannel instead. * @param {ColorChannel} value - The channel. */ setColorChannel(value: ColorChannel): void; /** * The masking technique. Default is `MaskFunction.DISCARD`. * * @type {MaskFunction} */ set maskFunction(arg: MaskFunction); /** * Sets the masking technique. Default is `MaskFunction.DISCARD`. * * @deprecated Use maskFunction instead. * @param {MaskFunction} value - The function. */ setMaskFunction(value: MaskFunction): void; set inverted(arg: boolean); /** * Indicates whether the masking is inverted. * * @type {Boolean} */ get inverted(): boolean; /** * Indicates whether the masking is inverted. * * @deprecated Use inverted instead. * @return {Boolean} Whether the masking is inverted. */ isInverted(): boolean; /** * Determines whether the masking should be inverted. * * @deprecated Use inverted instead. * @param {Boolean} value - Whether the masking should be inverted. */ setInverted(value: boolean): void; set strength(arg: number); /** * The current mask strength. * * Individual mask values will be clamped to [0.0, 1.0]. Has no effect when the mask function is set to `DISCARD`. * * @type {Number} */ get strength(): number; /** * Returns the current mask strength. * * @deprecated Use strength instead. * @return {Number} The mask strength. */ getStrength(): number; /** * Sets the mask strength. * * Has no effect when the mask function is set to `DISCARD`. * * @deprecated Use strength instead. * @param {Number} value - The mask strength. */ setStrength(value: number): void; } /** * An outline shader material. * * @implements {Resizable} */ export class OutlineMaterial extends ShaderMaterial implements Resizable { /** * Constructs a new outline material. * * TODO Re