What is bloom in Three.js?
Bloom is a post-processing glow. Instead of drawing a halo on the mesh itself, Three.js renders the scene, picks out pixels above a luminance threshold, blurs those bright spots, and layers the blur back on top. UnrealBloomPass is the built-in pass that does this. A dark background plus a bright emissive material is what makes the glow read.
Step 1: Create Scene
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });Step 2: Add an emissive mesh
const geometry = new THREE.TorusKnotGeometry(2, 0.6, 150, 32);
const material = new THREE.MeshStandardMaterial({
color: 0x2ad1d6,
emissive: 0x0e5f63,
metalness: 0.7,
roughness: 0.25
});
const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);Step 3: Wire EffectComposer
This is the part that usually breaks: you must stop using renderer.render.
const composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(scene, camera));
composer.addPass(new UnrealBloomPass(
new THREE.Vector2(innerWidth, innerHeight),
0.48, // strength
0.22, // radius
0.32 // threshold
));
composer.addPass(new OutputPass());Step 4: Animate with composer.render
function animate() {
requestAnimationFrame(animate);
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.01;
composer.render();
}
animate();Full Working Code (Copy & Paste)
Three.js Bloom Glow Demo