MCPcopy Create free account
hub / github.com/pmndrs/postprocessing / BloomEffect

Class BloomEffect

src/effects/BloomEffect.js:19–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 */
18
19export class BloomEffect extends Effect {
20
21 /**
22 * Constructs a new bloom effect.
23 *
24 * @param {Object} [options] - The options.
25 * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function of this effect.
26 * @param {Number} [options.luminanceThreshold=1.0] - The luminance threshold. Raise this value to mask out darker elements in the scene.
27 * @param {Number} [options.luminanceSmoothing=0.03] - Controls the smoothness of the luminance threshold.
28 * @param {Boolean} [options.mipmapBlur=true] - Enables or disables mipmap blur.
29 * @param {Number} [options.intensity=1.0] - The bloom intensity.
30 * @param {Number} [options.radius=0.85] - The blur radius. Only applies to mipmap blur.
31 * @param {Number} [options.levels=8] - The amount of MIP levels. Only applies to mipmap blur.
32 * @param {KernelSize} [options.kernelSize=KernelSize.LARGE] - Deprecated. Use mipmapBlur instead.
33 * @param {Number} [options.resolutionScale=0.5] - Deprecated. Use mipmapBlur instead.
34 * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead.
35 * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead.
36 * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead.
37 * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use mipmapBlur instead.
38 */
39
40 constructor({
41 blendFunction = BlendFunction.SCREEN,
42 luminanceThreshold = 1.0,
43 luminanceSmoothing = 0.03,
44 mipmapBlur = true,
45 intensity = 1.0,
46 radius = 0.85,
47 levels = 8,
48 kernelSize = KernelSize.LARGE,
49 resolutionScale = 0.5,
50 width = Resolution.AUTO_SIZE,
51 height = Resolution.AUTO_SIZE,
52 resolutionX = width,
53 resolutionY = height
54 } = {}) {
55
56 super("BloomEffect", fragmentShader, {
57 blendFunction,
58 uniforms: new Map([
59 ["map", new Uniform(null)],
60 ["intensity", new Uniform(intensity)]
61 ])
62 });
63
64 /**
65 * A render target.
66 *
67 * @type {WebGLRenderTarget}
68 * @private
69 */
70
71 this.renderTarget = new WebGLRenderTarget(1, 1, { depthBuffer: false });
72 this.renderTarget.texture.name = "Bloom.Target";
73
74 /**
75 * A blur pass.
76 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…