Hi everyone,
I’m working on a Three.js scene with a 3D model. I want to apply a bloom effect to specific nodes of the model (let’s say node18
and node19
). To achieve this, I’ve set these nodes to a different layer (layer 1
) while keeping the rest of the scene on the default layer (layer 0
).
I’m rendering the two layers separately:
- Layer 0: Rendered without bloom.
- Layer 1: Rendered with the bloom effect applied.
The bloom rendering itself works fine, but my issue arises when trying to combine the post-processed bloom layer with the regular rendered scene. Using the code below, I can only see the objects in layer 1
(the bloom layer), and the objects from layer 0
disappear.
Here’s my current setup:
export function buildScene()
{
initScene();
initRenderer();
initCamera();
initCSSRenderer();
initSkybox();
initLights();
initControls();
loadModels();
addEventListeners();
composerBloom = new EffectComposer(renderer);
const renderBloom = new RenderPass(scene, camera);
composerBloom.addPass(renderBloom);
const bloomPass = new UnrealBloomPass(
new THREE.Vector2(window.innerWidth, window.innerHeight),
1.5, // Intensity
0.5, // Radius
0.1 // Threshold
);
composerBloom.addPass(bloomPass);
}
function animate()
{
requestAnimationFrame(animate);
if (controls) controls.update(0.01);
camera.layers.set(0);
renderer.autoClear = true;
renderer.render(scene, camera);
camera.layers.set(1);
renderer.autoClear = false;
composerBloom.render();
if (cssRenderer && scene && camera)
cssRenderer.render(scene, camera);
}
buildScene();
animate();
What Happens
With the code above, I can only see the objects from layer 1
(bloom), and layer 0
is not visible. It seems like the composerBloom.render()
is overwriting the regular render output.
What I Want to Achieve
I’d like to combine the two layers so that:
- The objects on
layer 0
(regular render) appear without bloom. - The objects on
layer 1
(with bloom) are rendered over the top.
I’m not sure how to properly mix the post-processed bloom pass with the regular render. Any suggestions or insights into how to fix this would be greatly appreciated!
Thanks in advance!