1380 MODELS INDEXED Account
GUIDE · THREE.JS RENDERING

Selective bloom in three.js: glowing windows without glowing everything

UPDATED
22 MIN READ · BY 3D ASSET

Bloom in three.js is “selective” as soon as the scene is rendered in HDR: make the luminance of glowing surfaces (0.2126 R + 0.7152 G + 0.0722 B of emissive colour × intensity, in linear units) higher than 1.0, keep everything else below it, and set UnrealBloomPass’s threshold to about 1. That costs one bloom pass and nothing else. If lit surfaces still cross the threshold, write emissive into a second render target (MRT) and bloom only that — still one scene pass. The darken-materials example renders the scene twice; on our 11,677-draw night block that doubled the frame time.

The night city, and what “selective” has to mean

A night street of brick tenements with lit windows, shop fronts and glowing street lamps
A street in the showcase block of our Brown City pack, rendered at night with the emissive-MRT method from this article. 107 window panes are switched on, 12 street lamps carry real point lights, and only emitters bloom.

A city at night sells itself on its lights: warm windows, street lamps, a cinema marquee, the green of a traffic signal. Every one of those needs a soft halo, and nothing else may get one — not the lamp-lit pavement, not a pale wall, not the sky. That is what people mean by selective bloom, and it is one of the oldest recurring questions on the three.js forum: “EffectComposer + Layers”, “How to use bloom effect not for all objects”, “Light emitting objects” and “Selective UnrealBloomPass issues” have collected some 80,000 views between them.

The answers in those threads fall into four families. We built all four on the same scene and measured them:

  1. Threshold bloom — one UnrealBloomPass over the whole HDR frame. Selective because only emitters are brighter than the threshold.
  2. Darken non-bloom materials — the official webgl_postprocessing_unreal_bloom_selective example: render the scene a second time with every non-glowing mesh switched to black, bloom that.
  3. Emissive MRT buffer — one scene pass writes the colour and, into a second attachment, the emissive term; bloom reads only the emissive. Native in WebGPURenderer, a small shader patch in WebGLRenderer.
  4. Glow cards — no post-processing: an additive halo quad behind each emitter.

The scene is block-01, the showcase block of the Brown City pack: 17,816 meshes, 433,767 triangles, 498 materials, 11,677 draw calls from our camera. It is a deliberately honest test — a real asset export, not a benchmark of cubes — and it turned out to be a useful one, because it is limited by draw calls on the CPU rather than by pixels on the GPU, like many real web scenes. To see the GPU side as well we also merged the block by material (477 draws) and rendered it up to 4K.

Scope: three.js r180, WebGLRenderer with EffectComposer-style passes, and WebGPURenderer with TSL post-processing for method 3. Measured on Apple M5 (MacBook), Chrome 158 (ANGLE → Metal for WebGL, Dawn → Metal for WebGPU), three.js r180. The same scene and camera everywhere; only the bloom path changes.

The short version

Scroll the table sideways for all columns →

MethodScene passesSelective byFrame, real block (1080p)Verdict
1 · Threshold1Brightness18.8 msDefault choice. Works if you control HDR values.
2 · Darken materials2Object (layer)38.5 msAvoid on draw-heavy scenes: renders the scene twice.
3 · Emissive MRT1Emissive light18.8 msMost robust selection. Native on WebGPU; on WebGL at 4K the whole MRT pipeline added 2.7 ms to the HDR frame in our test.
4 · Glow cards1 (+1 draw)Placement17 msNo post-processing at all; keeps MSAA; looks stamped up close.

Frame times are the mean of 2 passes; the passes differed by up to about 2 ms, so differences of a millisecond or two between methods 1, 3 and 4 are noise. Methods 1–3 were measured with the manual composite shown under method 3 (scene into a 4× MSAA half-float target, bloom, one composite pass), not with EffectComposer. Glow cards were measured straight on the antialiased canvas, with no HDR target.

Without bloom the same frame takes 19.4 ms through the HDR target and 18.2 ms straight to the canvas. The rest of the article explains each method with working code, shows where it breaks, and gives the numbers behind that table.

Why bloom is not selective by default (and why it nearly is)

UnrealBloomPass does four things: a high-pass that keeps pixels whose luminance is above threshold, five progressively smaller blur levels starting at half resolution, a weighted sum of those levels, and an additive blend of the result over the frame. Nothing in it knows about objects. Whatever is brighter than the threshold glows.

The trick is in the word brighter. In current three.js EffectComposer renders into HalfFloatType targets by default, and the scene is drawn there in linear HDR: no tone mapping, no sRGB encoding — those happen at the very end in OutputPass. In that buffer values above 1.0 are kept instead of being clipped.

The bloom threshold is compared with the luminance of each pixel — 0.2126 R + 0.7152 G + 0.0722 B in the linear working space — not with the intensity you typed and not with the brightest channel. Colours in three.js are stored linear, so emissive = 0xffa95c is (1.0, 0.40, 0.11) with a luminance of 0.50. At emissiveIntensity = 2.4 its red channel is 2.4, but its luminance is 1.21: it passes a threshold of 1.0, though not by much. At 1.5 it would be 0.76 and, without help from the lights, would not bloom at all. Colour matters a lot: a pure red emitter needs almost five times the intensity of a white one to reach the same luminance, a pure blue one fourteen times.

So the first answer to “bloom only some objects” is to make those objects the only ones whose luminance is above 1.0, and put the threshold at 1.0. Most of the frustration in the old threads comes from setups where this cannot work. In an 8-bit render target nothing can exceed 1.0, so a threshold of 1.0 lets almost nothing bloom, and any lower threshold treats a white shirt and a neon tube alike. The whole scene glows when too many pixels pass the chosen threshold — typically a threshold of 0 or 0.1 copied from an example. And tone mapping before the bloom squashes every emitter back under 1.

import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';

renderer.toneMapping = THREE.ACESFilmicToneMapping; // applied by OutputPass, after bloom

const composer = new EffectComposer(renderer);       // HalfFloatType targets by default
composer.addPass(new RenderPass(scene, camera));
composer.addPass(new UnrealBloomPass(
  new THREE.Vector2(innerWidth, innerHeight),
  0.8,   // strength
  0.45,  // radius
  1.0    // threshold: linear luminance, so only HDR emitters pass
));
composer.addPass(new OutputPass());                   // tone mapping + sRGB

// A lit window: emissive pushed into HDR range by luminance, not by red channel.
const luminance = (c) => 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b; // c is linear
windowMaterial.emissive.set(0xffa95c);                 // luminance 0.50
windowMaterial.emissiveIntensity = 1.3 / luminance(windowMaterial.emissive); // ≈ 2.6

renderer.setAnimationLoop(() => composer.render());

glTF carries the same information. emissiveFactor is limited to 0–1, but the KHR_materials_emissive_strength extension multiplies it, and GLTFLoader maps it to emissiveIntensity. Blender writes the extension when an Emission strength above 1 is exported. Our block arrives with daytime emissive levels (lamp glass at 3.2, most interiors well below 1); for the night shots we raised every light-source material to a brightest channel of 1.6–7 (its luminance is lower, depending on the colour) and left everything else alone.

Emissive is not light

The “Light emitting objects” thread asks the question behind all of this: how do I make an object that lights its surroundings? In a rasteriser, you do not. emissive is added to the surface’s own colour and stops there; bloom then smears that colour over neighbouring pixels, which reads as glow but lights nothing. The pavement under a street lamp is bright because there is a real PointLight there.

A pizzeria front at night: lamps glow with bloom but the pavement and walls around them stay dark
Emissive + bloom, no lights: the lamp heads glow, the pavement and the shop front around them stay dark.
The same pizzeria front with point lights at the lamps, lighting the pavement, planter and walls
The same frame with point lights at the lamps (12 in the scene). This is what makes them look like light sources.

Real lights are not cheap, and the number of lights is compiled into every lit shader, so it must not change at runtime. We keep a fixed pool of lights and hand them to the fixtures nearest to the camera; how and why is in our article on light count and shader recompilation. For hundreds of windows, real lights are out of the question anyway — windows only need to look lit, which is the job of emissive plus bloom.

Method 1: threshold bloom

This is the code above, and in our scene it is already almost selective: nearly every glowing surface is above 1.0, and the moonlit walls and the lamp-lit pavement are below it. The bloom pass adds five blur levels at half resolution and below; on a draw-bound scene that work hides behind the CPU almost completely.

A cinema with a bulb marquee and vertical sign at night, no bloom
No bloom. Emitters are flat colour.
The same cinema with threshold bloom: bulbs and lit windows glow
Threshold 1.0: the bulbs and lit windows glow, walls do not — but the CINEMA letters on the vertical sign and on the marquee stay flat.

The weakness is that the selection is a brightness test, so it is only as good as your control over brightness. Three things push ordinary surfaces over the line:

  • Strong real lights. A wall right next to a point light, a car headlight on a road, a spotlight on a statue — lit surfaces in HDR can easily go past 1. In a day scene the sun does this to every white surface.
  • Specular highlights. Wet or metallic materials produce small, very bright highlights that bloom into sparkles. Sometimes that is welcome; often it is noise.
  • Textured emitters. An emissiveMap multiplies the emissive colour, so a sign whose texture is mostly mid-orange ends up well below the intensity you typed. In our cinema the bulbs passed the threshold and the CINEMA letters, which use an emissive texture, did not (see the crops further down).
  • Exposure and tone mapping changes. The threshold is in linear scene units, before toneMappingExposure. Raise the light levels for a darker tone curve and the threshold no longer separates the same things.
The pizzeria front with bloom threshold 0.2: the lamp-lit planter, lamp post and walls glow and the frame looks hazy
Threshold 0.2: the lamp-lit planter, the lamp post and the wall pass the high-pass and the frame turns hazy.
The same frame with threshold 1.0: only the lamps and windows glow
Threshold 1.0 on the same frame: only emitters pass.

Practical rules that made threshold bloom work for us: decide on an HDR budget in luminance (lit surfaces below about 0.8, emitters about 1.2 and up — compute the intensity from the colour, as in the snippet above), keep the threshold at 1.0 and tune strength and radius rather than threshold, and check the scene with the brightest light situation you will ship. If your art direction needs a pale surface brightly lit next to a weak glow — a lamp-lit white wall beside a dim neon — brightness cannot separate them, and you need one of the next two methods.

The high-pass in UnrealBloomPass is a smooth step 0.01 wide above the threshold. A pixel that passes contributes its full colour to the blur, not just the part above the threshold.

Method 2: darken everything else and render again

This is the official example, and the method most of the forum threads end up with. Objects that should glow are put on a layer; every frame the scene is drawn once normally, then a second time with every other mesh temporarily switched to a black MeshBasicMaterial. The second image is bloomed with threshold 0 and added to the first.

const BLOOM_LAYER = 1;
const bloomLayer = new THREE.Layers(); bloomLayer.set(BLOOM_LAYER);
glowingMesh.layers.enable(BLOOM_LAYER);

const darkMaterial = new THREE.MeshBasicMaterial({ color: 'black' });
const stored = {};
function darken(obj) {
  if (obj.isMesh && !bloomLayer.test(obj.layers)) { stored[obj.uuid] = obj.material; obj.material = darkMaterial; }
}
function restore(obj) {
  if (stored[obj.uuid]) { obj.material = stored[obj.uuid]; delete stored[obj.uuid]; }
}

// Composer 1: the darkened scene + bloom, kept off screen.
const bloomComposer = new EffectComposer(renderer);
bloomComposer.renderToScreen = false;
// Clear to black whatever renderer.setClearColor() says; RenderPass restores it afterwards.
bloomComposer.addPass(new RenderPass(scene, camera, null, new THREE.Color(0x000000), 1));
bloomComposer.addPass(new UnrealBloomPass(new THREE.Vector2(w, h), 0.8, 0.45, 0));

// Composer 2: the normal scene + the bloom texture, then tone mapping.
const mixPass = new ShaderPass(new THREE.ShaderMaterial({
  uniforms: {
    baseTexture: { value: null },                                  // filled by the composer
    bloomTexture: { value: bloomComposer.renderTarget2.texture }
  },
  vertexShader: 'varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }',
  fragmentShader: 'uniform sampler2D baseTexture, bloomTexture; varying vec2 vUv;' +
    'void main() { gl_FragColor = texture2D(baseTexture, vUv) + texture2D(bloomTexture, vUv); }'
}), 'baseTexture'); // without this argument ShaderPass fills tDiffuse
const finalComposer = new EffectComposer(renderer);
finalComposer.addPass(new RenderPass(scene, camera));
finalComposer.addPass(mixPass);
finalComposer.addPass(new OutputPass());

renderer.setAnimationLoop(() => {
  const background = scene.background;
  scene.background = null;      // a sky colour would otherwise bloom across the frame
  scene.traverse(darken);
  bloomComposer.render();       // second full scene render
  scene.traverse(restore);
  scene.background = background;
  finalComposer.render();
});

Note what bloomTexture contains. UnrealBloomPass ends by blending the blur over its input, so the bloom composer’s output is the darkened image plus the halo: the selected objects themselves are in it. The mix shader then adds them to the base image a second time, and glowing objects come out brighter than they are in the normal render. That is how the official example looks, and you can compensate with emissive levels. If you want only the halo, take the blurred result before the blend — the bloomFrom helper under method 3 does that, and it is the variant we measured.

It has real advantages. Selection is per object, independent of brightness, so a dim object can glow and a blinding one need not. Black occluders keep their depth, so walls hide the glow of things behind them. And it needs nothing special from the materials.

The bloom input of the darken method: the city in black, only the glowing objects visible
What the second pass renders: every non-glowing mesh black. Occluders still block emitters behind them.
The cinema with darken-method bloom
The result. The whole object glows, including its lit diffuse colour, not only its emissive part.

The price is that the scene is rendered twice — all culling, all state changes, all 11,677 draw calls — plus two traversals of 17,816 objects that swap materials. On our block that took the frame from 19.4 ms to 38.5 ms (52 FPS → 26 FPS), almost all of it on the CPU. Several smaller problems come with it:

  • Whole objects glow, not emitters. A lamp head modelled as one mesh with glass and metal blooms entirely. You end up splitting meshes just for bloom.
  • The stand-in must match the original. One black MeshBasicMaterial ignores alpha-tested leaves, displacement and custom vertex shaders, so foliage turns into black rectangles and patched geometry into the wrong silhouette in the bloom input — glow then gets cut by occluders that are not there.
  • Background and transparency. The bloom input must be black around the emitters, so the loop hides scene.background and the bloom RenderPass clears to black; leave either out and a grey sky turns white in the bloom. Transparent objects, sprites, points and lines need their own dark stand-ins; this is the issue behind most of the replies in “Selective UnrealBloomPass issues”.
  • No MSAA in the bloom input unless you pay for it a second time — usually invisible in a blurred image, but edges of small emitters shimmer when the camera moves.

The shortcut that breaks: camera layers alone

The obvious optimisation — and the subject of the “EffectComposer + Layers” thread — is to skip the material swap: set camera.layers to the bloom layer for the bloom pass so only glowing objects are drawn. It is cheaper, because the second pass draws only 471 meshes. It is also wrong: nothing occludes the emitters any more, so every lit window in the block glows through the buildings in front of it.

An aerial view of the block where glow from windows hidden behind buildings shines through walls and roofs
Bloom input rendered with camera.layers only: the halos of every lit window, including those on the far sides of the buildings, show through roofs and walls.
The same aerial view with the darken method: only visible windows glow
The same view with the darken method: black occluders keep their depth and only visible windows glow.

It can be fixed — render a depth-only prepass of the occluders and draw the bloom layer with depthFunc = LessEqualDepth against that depth — but at that point you are drawing every occluder twice again, just more cheaply. The emissive buffer of method 3 gets the same occlusion for free.

Method 3: one pass, emissive into a second render target

The cleanest idea is to stop asking which objects should glow and ask which light should: the emissive term. Every lit three.js material already computes it as totalEmissiveRadiance. If the same scene pass writes that value into a second colour attachment — multiple render targets, MRT — bloom can run on it with threshold 0. Occlusion is correct by construction, because the emissive buffer shares the depth test with the colour. A lamp’s glass glows while the metal frame of the same mesh does not, and a lit wall can be as bright as you like.

WebGPURenderer: built in

In WebGPURenderer with TSL this is a few lines and the documented way to do it (see the official webgpu_postprocessing_bloom_emissive example):

import * as THREE from 'three/webgpu';
import { pass, mrt, output, emissive } from 'three/tsl';
import { bloom } from 'three/addons/tsl/display/BloomNode.js';

const renderer = new THREE.WebGPURenderer({ antialias: false });
await renderer.init();

const scenePass = pass(scene, camera, { samples: 4 });
scenePass.setMRT(mrt({ output, emissive }));     // one pass, two targets

const color = scenePass.getTextureNode('output');
const glow  = scenePass.getTextureNode('emissive');

const post = new THREE.PostProcessing(renderer);
post.outputNode = color.add(bloom(glow, 0.8, 0.45, 0)); // threshold 0: emissive only

renderer.setAnimationLoop(() => post.render());

If you want selection per object rather than per emissive value, the webgpu_postprocessing_bloom_selective example adds a bloomIntensity output, 0 by default, and sets material.mrtNode on the materials that should glow.

One trap we hit in r180: calling renderer.compileAsync(scene, camera) before the first post.render() built the materials’ pipelines for the canvas, with one colour target. The MRT pass then reused them with two targets, WebGPU rejected every pipeline (“Color target has no corresponding fragment stage output”) and the frame was black. Warm up by rendering through the post-processing chain instead.

WebGLRenderer: a small shader patch

WebGLRenderer supports MRT through WebGLRenderTarget with count: 2, but the built-in materials write only one output. onBeforeCompile adds the second. All lit materials share one patch, so the program count does not grow:

function writeEmissiveToMRT(material) {
  const hasEmissive = material.emissive !== undefined;
  material.onBeforeCompile = (shader) => {
    const anchor = '#include <dithering_fragment>';
    if (!shader.fragmentShader.includes(anchor)) return console.warn('no MRT patch for', material.type);
    // Alpha follows the fragment (1.0 for opaque materials), so transparent
    // surfaces blend into attachment 1 the same way they blend into attachment 0.
    shader.fragmentShader = 'layout(location = 1) out highp vec4 gEmissive;\n' +
      shader.fragmentShader.replace(anchor, anchor + `
        gEmissive = vec4(${hasEmissive ? 'totalEmissiveRadiance' : 'vec3(0.0)'}, diffuseColor.a);
        #ifdef PREMULTIPLIED_ALPHA
          gEmissive.rgb *= gEmissive.a;
        #endif`);
  };
  material.customProgramCacheKey = () => 'mrt-emissive-' + hasEmissive;
  material.needsUpdate = true;
}
scene.traverse((o) => { if (o.isMesh) [].concat(o.material).forEach(writeEmissiveToMRT); });

const sceneTarget = new THREE.WebGLRenderTarget(w, h, {
  type: THREE.HalfFloatType, samples: 4, count: 2   // [0] colour, [1] emissive
});

Patch every material that is drawn into that target, including non-glowing ones: an output a shader does not write is undefined, not zero. Rendering the patched materials to a single-attachment target is harmless — the second output is simply dropped — so the same programs serve both.

The alpha written to gEmissive matters more than it looks. Blending is set per draw, not per attachment, so a transparent pane of glass blends into the emissive buffer with the same factors as into the colour buffer. Our first version wrote alpha 1.0: every non-emissive glass pane then replaced the emissive behind it with zero, and the cinema lobby behind its glass doors lost its glow while still being visible in the frame. Writing the fragment’s own alpha (and premultiplying when the material does) fixes that for normal and additive blending. Coverage is limited to mesh materials built from three.js’ standard shader chunks: Points, Line, Sprite, ShaderMaterial and custom blending modes need their own second output.

UnrealBloomPass reads its input from readBuffer.texture, which on an MRT target is attachment 0. We call its internal steps directly with attachment 1 as input and skip its final blend, then add bloom and apply tone mapping in one full-screen pass. The helper uses fields that are not part of the public API, so pin your three.js version or copy the pass:

import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';

// Strength and radius as in method 1; the threshold is set to 0 inside bloomFrom().
const bloom = new UnrealBloomPass(new THREE.Vector2(w, h), 0.8, 0.45, 0);

// UnrealBloomPass without its final blend; returns the bloom texture.
function bloomFrom(pass, renderer, input) {
  const quad = pass._fsQuad;
  const autoClear = renderer.autoClear, clearAlpha = renderer.getClearAlpha();
  const clearColor = renderer.getClearColor(new THREE.Color());
  renderer.autoClear = false; renderer.setClearColor(0x000000, 0);
  pass.highPassUniforms.tDiffuse.value = input;
  pass.highPassUniforms.luminosityThreshold.value = 0;
  quad.material = pass.materialHighPassFilter;
  renderer.setRenderTarget(pass.renderTargetBright); renderer.clear(); quad.render(renderer);
  let src = pass.renderTargetBright;
  for (let i = 0; i < pass.nMips; i++) {
    const m = pass.separableBlurMaterials[i]; quad.material = m;
    m.uniforms.colorTexture.value = src.texture; m.uniforms.direction.value = UnrealBloomPass.BlurDirectionX;
    renderer.setRenderTarget(pass.renderTargetsHorizontal[i]); renderer.clear(); quad.render(renderer);
    m.uniforms.colorTexture.value = pass.renderTargetsHorizontal[i].texture; m.uniforms.direction.value = UnrealBloomPass.BlurDirectionY;
    renderer.setRenderTarget(pass.renderTargetsVertical[i]); renderer.clear(); quad.render(renderer);
    src = pass.renderTargetsVertical[i];
  }
  quad.material = pass.compositeMaterial;
  pass.compositeMaterial.uniforms.bloomStrength.value = pass.strength;
  pass.compositeMaterial.uniforms.bloomRadius.value = pass.radius;
  renderer.setRenderTarget(pass.renderTargetsHorizontal[0]); renderer.clear(); quad.render(renderer);
  renderer.autoClear = autoClear; renderer.setClearColor(clearColor, clearAlpha);
  return pass.renderTargetsHorizontal[0].texture;
}

// Final pass: colour + bloom, then tone mapping and sRGB (what OutputPass does).
const composite = new FullScreenQuad(new THREE.ShaderMaterial({
  uniforms: { tBase: { value: null }, tBloom: { value: null } },
  vertexShader: 'varying vec2 vUv; void main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }',
  fragmentShader: `uniform sampler2D tBase, tBloom; varying vec2 vUv;
    void main() {
      gl_FragColor = vec4(texture2D(tBase, vUv).rgb + texture2D(tBloom, vUv).rgb, 1.0);
      #include <tonemapping_fragment>
      #include <colorspace_fragment>
    }`
}));

// The scene pass. A clear fills every attachment with the same colour, so a sky
// colour would land in the emissive buffer and bloom everywhere: clear first,
// then reset attachment 1 to black, then draw without clearing again.
const savedClear = new THREE.Color();
function renderScene() {
  const gl = renderer.getContext();
  const background = scene.background;   // null or a THREE.Color (see the note below)
  const autoClear = renderer.autoClear, clearAlpha = renderer.getClearAlpha();
  renderer.getClearColor(savedClear);
  renderer.setRenderTarget(sceneTarget);
  // setClearColor converts for the current target (linear here), so call it after setRenderTarget.
  if (background && background.isColor) renderer.setClearColor(background, 1);
  else renderer.setClearColor(savedClear, clearAlpha);
  renderer.clear();
  gl.clearBufferfv(gl.COLOR, 1, [0, 0, 0, 0]);
  scene.background = null; renderer.autoClear = false;
  renderer.render(scene, camera);                         // the only scene pass
  scene.background = background; renderer.autoClear = autoClear;
  renderer.setClearColor(savedClear, clearAlpha);
}

function render() {
  renderScene();
  const glow = bloomFrom(bloom, renderer, sceneTarget.textures[1]);
  composite.material.uniforms.tBase.value = sceneTarget.textures[0];
  composite.material.uniforms.tBloom.value = glow;
  renderer.setRenderTarget(null);
  composite.render(renderer);
}
renderer.setAnimationLoop(render);   // or call render() from your existing loop
The emissive attachment of the MRT pass: black city, only emitters coloured
Attachment 1: only the emissive term. Unlike the darken input, the lit colour of glowing meshes is not in it — only their light.
The cinema with emissive-MRT bloom
The result. Bulbs, letters and windows glow; the marquee’s frame and the pavement do not.

Why not plug the MRT target into EffectComposer and use the stock pass? Because UnrealBloomPass reads readBuffer.texture — attachment 0, the colour — and finishes with its own additive blend into that buffer. We need it to read attachment 1 and we want the bloom added once, in the same final pass that applies tone mapping. Calling the blur steps directly and compositing straight into the canvas does both and saves a full-screen copy.

Two details in that code are easy to drop when you adapt it. First, a clear in WebGL fills all colour attachments with the clear colour: with scene.background set to a colour, three.js clears the MRT target to it inside render(), and the sky ends up in the emissive buffer, where a threshold of 0 blooms it over the whole frame. Hence renderScene(): clear, reset attachment 1 with clearBufferfv, then draw with autoClear off. Set the clear colour after setRenderTarget(): three.js converts it for the target that is current at that moment, and a colour set while the canvas was current lands in the linear target as its sRGB value (0x777777 came out as 0.467 instead of 0.184 in our test). A texture or cube-map background is drawn as a mesh whose shader does not write the second output, so with one of those, patch the background material too or render the sky after the MRT pass. Second, bloomFrom() changes the clear colour and autoClear and puts both back, so the rest of your rendering is not affected.

Costs and limits: the MRT target needs a second half-float attachment (at 1080p with 4× MSAA, about 83 MB of nominal storage for the multisampled buffer and its resolve texture), and every fragment writes 8 more bytes. Fog is not applied to the emissive output in the patch above; mix it with fogFactor as fog_fragment does if distant emitters must fade.

Method 4: glow cards, no post-processing

The cheapest bloom is no bloom: draw a soft additive halo around each emitter and let depth testing hide the ones behind walls. Games did this for decades with lens-flare sprites, and it still has a place — on mobile, in VR where post-processing is expensive, or in a scene that cannot afford an HDR target at all. It renders straight to the canvas with its native MSAA — no HDR target, no full-screen pass — and costs one extra draw call.

We generated the cards from the same 471 glowing meshes: flat emitters (window panes, signs) get a quad in their own plane, slightly larger than the pane, on both faces; compact ones (bulbs, lenses, lamp glass) get a camera-facing billboard. All 671 quads are one BufferGeometry. Each vertex carries the card’s centre, two half-axes, the glow colour and a billboard flag; the vertex shader expands planar cards along their axes in world space and billboards the rest in view space. Below is the fragment shader, the part that makes the halo:

// Fragment shader only. Material: ShaderMaterial with AdditiveBlending,
// depthWrite: false, depthTest: true, side: DoubleSide, toneMapped: true.
uniform float strength;
varying vec2 vUv;
varying vec3 vGlow;
void main() {
  float r = length(vUv * 2.0 - 1.0);
  float a = pow(clamp(1.0 - r, 0.0, 1.0), 2.2);
  gl_FragColor = vec4(vGlow * a * strength, 1.0);
  #include <tonemapping_fragment>
  #include <colorspace_fragment>
}
The cinema with additive glow cards instead of bloom
Glow cards: round halos on bulbs and lamps, planar glow on windows and on the marquee board.
Close-up of a pizzeria front with billboard halos around the lamp and the oven fire
Close up, billboards read as discs: the lamp gets a flat orange ball and the oven fire behind the glass a red one.

Limitations are visual rather than technical. A card has a fixed shape, so the glow does not spread more where emitters cluster and does not bleed over silhouettes the way real bloom does. Billboards intersect nearby walls; planar halos vanish at grazing angles. Cards must be rebuilt when emitters move or switch, and a lit window needs a card per pane. As a supplement — a halo on the few hero lamps in a scene that already has a gentle threshold bloom — they work well.

Measured: what each method costs

Method: every configuration on a fresh page load, the scene warmed up, then the browser’s own frame loop for 4 seconds with vsync and the frame-rate limit switched off (--disable-gpu-vsync --disable-frame-rate-limit), so each requestAnimationFrame starts as soon as the previous frame is done. We report the median frame interval. That is the number a user feels, CPU and GPU together, and it works the same for WebGL and WebGPU. Every configuration ran in 2 separate passes; the values are their mean. “No bloom” renders into the same multisampled half-float target and composite pass as methods 1–3, so the difference to it is the cost of the bloom itself. Glow cards render to the antialiased canvas like the “canvas, no post” reference, which is their baseline. Device pixel ratio 1; the canvas size is the render size. One difference from the code above: the measured WebGL MRT path did not reset the emissive attachment after the clear, so the scene background (0x070b16, linear luminance about 0.0034) was also in the emissive buffer and the bloom added a faint uniform haze. It is far below anything visible in the published frames; the number of passes and draws is the same, but we did not time the corrected version separately.

Why not GPU timer queries? EXT_disjoint_timer_query_webgl2 is available on this machine, but on Apple’s tile-based GPUs under ANGLE → Metal its numbers did not follow the work: a full-screen copy “cost” 4 ms because it absorbed the MSAA resolve of the pass before it, and totals did not grow with 4× the pixels. Frame intervals did.

The real block: draw-bound

As exported, the block draws 11,677 meshes from this camera. Rendering them straight to the canvas takes 18.2 ms per frame at 1080p, and merged into 477 draws the same view takes 3.5 ms. Merging is not exactly the same work — a merged mesh is culled as a whole, so more triangles are drawn — but a drop of that size says the scene is limited by the number of draw calls rather than by shading. Work that runs only on the GPU — the bloom blurs, the MRT write, the composite — then has room to overlap with it:

Chart scrolls sideways · full numbers in the table under it →

Frame time, real block at 1080p (lower is better)

  • WebGLRenderer
0 ms10 ms20 ms30 ms40 msNo bloom (HDR target)WebGLRenderer, No bloom (HDR target): 19 ms19 ms1 · ThresholdWebGLRenderer, 1 · Threshold: 19 ms19 ms2 · Darken materialsWebGLRenderer, 2 · Darken materials: 39 ms39 ms3 · Emissive MRTWebGLRenderer, 3 · Emissive MRT: 19 ms19 ms4 · Glow cards (canvas)WebGLRenderer, 4 · Glow cards (canvas): 17 ms17 msCanvas + MSAA, no postWebGLRenderer, Canvas + MSAA, no post: 18 ms18 ms
Median frame interval, mean of 2 passes, Apple M5 (MacBook), Chrome 158 (ANGLE → Metal for WebGL, Dawn → Metal for WebGPU), three.js r180. Methods 1–3 compare with “No bloom”, glow cards with the canvas row.
All values (mean of the passes; individual passes in brackets)
MethodFramep90 frame
No bloom (HDR target)19.4 ms (18.3, 20.5)20.8 ms
1 · Threshold18.8 ms (18.2, 19.4)19.9 ms
2 · Darken materials38.5 ms (39.5, 37.6)40.1 ms
3 · Emissive MRT18.8 ms (18.3, 19.2)19.5 ms
4 · Glow cards (canvas)17 ms (17.2, 16.8)33.4 ms
Canvas, no post18.2 ms (17.6, 18.8)19.1 ms

Threshold and MRT land within run-to-run noise (up to about 2 ms between passes) of the no-bloom frame, and glow cards within noise of the plain canvas on median. Their 90th percentile is another matter: 33.4 ms for glow cards against 19.1 ms for the plain canvas — more than one frame in ten took about twice as long, in both passes, so it is reproducible for this configuration. We did not find the cause; the median sits right at one 60 Hz interval (16.7 ms), and a frame that just misses it can be held for a second interval. Treat the medians as the comparison and that p90 as an unexplained result, not as a cost of the cards themselves. The darken method adds +19.1 ms, about the cost of a second scene pass, and its 90th-percentile frame is 40.1 ms. That the cost follows the number of draws rather than pixels shows in the merged block below, where the same method adds only 0.85 ms at 1080p. On a scene like this the choice of bloom method is mostly a question of whether you render the scene once or twice.

The merged block: GPU-bound

Merging the block by material leaves 477 draw calls for the same view. Now the frame is cheap on the CPU, and the cost of bloom itself becomes visible — and grows with resolution, because bloom is full-screen work:

Chart scrolls sideways · full numbers in the table under it →

Frame time, merged block (lower is better)

  • 1080p
  • 1440p
  • 4K
0 ms5 ms10 ms15 ms20 msNo bloom (HDR target)1080p, No bloom (HDR target): 3.8 ms3.8 ms1440p, No bloom (HDR target): 6.1 ms6.1 ms4K, No bloom (HDR target): 12 ms12 ms1 · Threshold1080p, 1 · Threshold: 4.0 ms4.0 ms1440p, 1 · Threshold: 6.4 ms6.4 ms4K, 1 · Threshold: 13 ms13 ms2 · Darken materials1080p, 2 · Darken materials: 4.6 ms4.6 ms1440p, 2 · Darken materials: 7.0 ms7.0 ms4K, 2 · Darken materials: 14 ms14 ms3 · Emissive MRT1080p, 3 · Emissive MRT: 4.3 ms4.3 ms1440p, 3 · Emissive MRT: 7.4 ms7.4 ms4K, 3 · Emissive MRT: 15 ms15 ms4 · Glow cards (canvas)1080p, 4 · Glow cards (canvas): 3.5 ms3.5 ms1440p, 4 · Glow cards (canvas): 5.0 ms5.0 ms4K, 4 · Glow cards (canvas): 10 ms10 msCanvas + MSAA, no post1080p, Canvas + MSAA, no post: 3.5 ms3.5 ms1440p, Canvas + MSAA, no post: 5.0 ms5.0 ms4K, Canvas + MSAA, no post: 9.9 ms9.9 ms
Median frame interval with 477 draws, WebGLRenderer. 4K is also what a 1080p canvas costs at device pixel ratio 2.
All values: median frame (mean p90 of the passes)
Method1080p1440p4K
No bloom (HDR target)3.75 ms (p90 4.2 ms)6.1 ms (p90 6.6 ms)12.2 ms (p90 13.3 ms)
1 · Threshold3.95 ms (p90 4.45 ms)6.4 ms (p90 6.85 ms)13.3 ms (p90 14.2 ms)
2 · Darken materials4.6 ms (p90 5.15 ms)7 ms (p90 7.65 ms)14.3 ms (p90 15.7 ms)
3 · Emissive MRT4.3 ms (p90 5.15 ms)7.4 ms (p90 7.9 ms)14.9 ms (p90 22.9 ms)
4 · Glow cards (canvas)3.55 ms (p90 4.15 ms)5.05 ms (p90 5.9 ms)10.3 ms (p90 11.3 ms)
Canvas + MSAA, no post3.5 ms (p90 4.05 ms)4.95 ms (p90 5.3 ms)9.9 ms (p90 10.7 ms)

At 1080p everything is between 3.5 ms and 4.6 ms; bloom of any kind costs well under a millisecond. At 4K the differences open up. Over the no-bloom frame of 12.2 ms, threshold bloom adds 1.05 ms, the darken method 2.1 ms and the emissive MRT 2.7 ms. Glow cards add 0.35 ms to the plain canvas — and, unlike the other three, they never pay for the HDR target and composite pass, which on their own cost 2.3 ms at 4K.

These deltas are for the whole pipeline — filtering and blur included — not for any single buffer. At this resolution the passes differed by up to about 2 ms, so darken and MRT are effectively tied on median frame time, and threshold is the cheapest bloom; MRT came out 1.65 ms above threshold. The 90th percentiles are less tidy: at 4K darken’s p90 was 15.7 ms and MRT’s 22.9 ms — that comes from one of MRT’s two passes (p90 14.5 ms in one, 31.4 ms in the other). Two passes are too few to pin that on the method, so read the p90 column in the table above as a warning sign, not a ranking. One plausible contributor on WebGL: all attachments of a render target share its sample count, so the emissive buffer is a second 4× multisampled half-float buffer — 265 MB of nominal storage at 4K, plus a 66 MB resolve texture. How much of that turns into memory traffic depends on the GPU, and our test does not isolate it. The darken method’s second pass, at only 477 draws of a black material into a single-sampled target, is cheap here. If you are fill-bound on WebGL, keep the bloom inputs small — render without MSAA and use FXAA/SMAA, or write the emissive term at reduced resolution. If you are draw-bound — and most scenes built from many separate meshes are — a second scene pass is what hurts.

WebGPURenderer

We ran the same scene through WebGPURenderer with TSL post-processing: no bloom, threshold bloom and emissive MRT. The comparison inside WebGPU is what matters here — this is not a WebGL-versus-WebGPU benchmark, and the absolute numbers say more about the renderer’s per-object overhead on a 17,816-mesh scene than about bloom (we covered that in WebGPURenderer vs WebGLRenderer).

SceneNo bloomThresholdEmissive MRT
Real block, 1080p33.5 ms34 ms36.3 ms
Merged, 1080p3.3 ms4.4 ms4.4 ms
Merged, 1440p4.45 ms6.45 ms6.05 ms
Merged, 4K9.9 ms12.2 ms11.9 ms

Inside WebGPU, threshold and MRT bloom cost the same: 2.25 ms and 2.05 ms over no bloom at 4K, about 1–2 ms at lower resolutions. The extra MRT target, which costs a little on WebGL above, is nearly free here — most likely because WebGPU on Metal resolves both attachments inside the same render pass instead of with separate blits. On the real block every WebGPU configuration sits around 33.5 ms with a 90th percentile near 58 ms: the frame is dominated by per-object overhead at 17,816 meshes, and bloom disappears in it. If you are on WebGPURenderer anyway, the MRT setup is the one to use.

Quality side by side

Same camera, same bloom strength (0.8) and radius (0.45) for methods 1–3; threshold 1.0 for method 1 and 0 for 2 and 3. Crops are 2× enlargements of the cinema front: the bottom of the vertical CINEMA sign (the letter A and its bulbs), the marquee lettering below it and the bulb strip. Compare the letters first — that is where the methods differ.

Threshold bloom crop: the bulbs have only faint halos, and the letter A and the CINEMA lettering are flat with no glow
1 · Threshold: faint bulb halos, letters flat
Darken method crop: the letters and bulbs both glow, with wide warm halos
2 · Darken: letters and bulbs glow, widest halos
Emissive MRT crop: the letters and bulbs glow, the dark sign board behind them stays dark
3 · Emissive MRT: letters and bulbs glow, board dark
Glow cards crop: round halos on the bulbs, and a flat glowing rectangle over the whole marquee board
4 · Glow cards: a glowing rectangle over the marquee

Threshold blooms only what is above 1.0, and that is both its strength and its weakness: the bulbs pass with faint halos, but the CINEMA letters — an emissiveMap at night intensity — stay under the threshold and remain flat. You would raise their intensity, not lower the threshold. Darken blooms whole objects with threshold 0: letters and bulbs glow, and the halos are a little wider and warmer than with MRT because the lit diffuse colour of the glowing meshes is part of the bloom input too. Emissive MRT blooms exactly the emitted light: letters and bulbs glow by their emissive brightness, the board stays dark. Glow cards produced the most visible artefact: the marquee is one flat emitter, so it got one planar halo — a glowing rectangle laid over the sign — while the bulbs got neat round halos.

Making windows glow

Bloom only spreads what the materials give it. A few things decide whether a night city reads as inhabited or as a grid of orange stickers:

  • Not every window. We switched on 107 of the block’s dark panes by hashing each pane’s position — about 40%, a mix of warm (2,700 K-ish, intensity 2.4) and cooler (intensity 1.7) light. Two shared materials, no per-window material, so the draw count does not change.
  • Depth behind the glass. The Brown City buildings have interior cards behind lit windows — a back wall, a curtain, a silhouette — so a lit window has a gradient instead of a flat fill. In a texture-based facade, an interior-mapping shader or a baked emissive map with a few room variations does the same.
  • Emissive luminance above 1, base colour dark. A lit window is mostly light, not a bright diffuse surface. Dark color and an emissive whose luminance (not its brightest channel) is above the threshold keep it independent of the scene lights and make it the only thing that blooms.
  • Shop fronts and signs brighter than windows. A hierarchy of brightness gives bloom something to rank. In this scene, as the brightest emissive channel of mostly warm orange colours, that meant lamps and signs 3–7, shop fronts 2–3 and upstairs rooms 1.5–2.5 — which put some of the dimmer warm rooms just under the luminance threshold, so they glow without blooming. Other colours need other numbers; rank by luminance. If everything glows at the same level, nothing stands out.
  • Animate with uniforms. Turning windows on and off is emissiveIntensity or a swap between two existing materials — never a change of transparent, maps or defines, which compiles new shader programs mid-frame.
An aerial night view of the city block with scattered warm and cool lit windows
The whole block from above with emissive-MRT bloom: hashed lit windows, shop fronts brighter than upstairs rooms, lamps brightest of all.

Which one to use

  1. Start with threshold bloom and an HDR budget in luminance: lit surfaces below about 0.8, emitters about 1.2 and up (set emissiveIntensity from the colour’s luminance, not from its brightest channel), threshold 1.0. In most night scenes that is all you need, and it costs only the bloom pass.
  2. If lit surfaces leak into the bloom, move to the emissive MRT buffer. It selects by emissive light, keeps occlusion, and renders the scene once. On WebGPURenderer it is the standard setup; on WebGLRenderer it is a small patch.
  3. Use the darken-materials method only on light scenes — a product viewer, a few dozen meshes — or when you need per-object selection that has nothing to do with emissive. Never on a city.
  4. Do not use camera layers alone for the bloom input: emitters glow through walls.
  5. Use glow cards where post-processing is not an option (mobile, VR, no HDR target), or as an extra on a few hero lights.
  6. Measure on your scene. On a draw-bound scene bloom is nearly free and a second scene pass is not; on a fill-bound one at high resolution it is the other way round.

Frequently asked questions

Why does UnrealBloomPass make my whole scene glow?

Because too many pixels pass the threshold — almost always a threshold near 0 or 0.1 copied from an example, sometimes strong lights pushing lit surfaces over it. The opposite failure, no bloom at all at threshold 1.0, usually means an 8-bit target or tone mapping before the bloom, both of which keep every value at or below 1. Render into a half-float target (EffectComposer’s default), keep tone mapping in OutputPass at the end, set the threshold to about 1.0 and give emitters enough intensity that their luminance is above 1 — for a warm orange that means an emissiveIntensity of 2–3, not 1.5.

Does bloom make objects light up their surroundings?

No. Bloom blurs bright pixels over their neighbours in screen space; it does not light any surface. For a lamp to light the street you need a real light (or baked lighting). Use emissive plus bloom for how the source looks, and a small fixed set of lights for what it illuminates.

Can I use selective bloom with a transparent background?

Not with the code in this article as it stands: its final composite writes alpha 1.0, so the canvas is opaque. For a transparent page background, keep the scene’s alpha from attachment 0, add the bloom to the colour and raise alpha where bloom is present. max(base.a, luminance(bloom)) is a usable approximation, not an exact answer: a saturated halo can have a channel well above its luminance, so for a correct premultiplied result the alpha must be at least the largest bloom channel (clamped to 1) and the colour premultiplied consistently. Create the renderer with premultipliedAlpha matching your output. The darken method has the same problem and more, because its black stand-ins must also be cleared to transparent.

Is selective bloom possible without EffectComposer?

Yes — method 3 in this article uses UnrealBloomPass only for its blur passes and draws the final composite itself, and glow cards need no post-processing at all. With WebGPURenderer, PostProcessing and the TSL bloom node replace EffectComposer.

What about the postprocessing library’s SelectiveBloomEffect?

pmndrs/postprocessing offers a SelectiveBloomEffect that renders a selection of objects into a separate buffer and masks them with the scene depth. It is a well-packaged variant of the second-pass idea and has the same scaling: its cost follows the number of selected objects. We did not include it in these measurements.

Sources

More deep dives

ALL DEEP DIVES →