[ Post-Processing ] - Entire scene gets blurred while using bloom or other effects

The code regarding the creation of the composer:

    this.composer = new EffectComposer( this.renderer );
    const renderPass = new RenderPass( this.scene, this.camera );
    this.composer.addPass( renderPass );

    const unrealBloomPass = new UnrealBloomPass(new THREE.Vector2( window.innerWidth, window.innerHeight ), 0.5, 0.4, 0.85);
    this.composer.addPass( unrealBloomPass );

    const outputPass = new OutputPass();
    this.composer.addPass( outputPass );

Now the animation function:

function animate() {
  requestAnimationFrame(animate);

  sceneHandler.orbit.update();
  sceneHandler.composer.render()

  rayCaster.raycaster.setFromCamera( rayCaster.pointer, sceneHandler.camera );
  rayCaster.intersectObjectBbox()
}

Stars creation:

function randomValues(values: string[]) {
  return values[Math.floor(Math.random() * values.length)]
}
  
function createStar() {
  const geometry = new THREE.SphereGeometry(randomBetweenTwo(0.1, 5));
  const material = new THREE.MeshBasicMaterial({color: randomValues(['#fff891', 'rgb(33, 56, 255)', '#f8fdff'])});
  const sphere = new THREE.Mesh(geometry, material);
  return sphere;
}

Text creation:

function createText(text: string, font: Font) {
  const geometry = new TextGeometry(text, {
    font,
    size: 20,
    height: 5,
  });
  const materials = [
    new THREE.MeshStandardMaterial({ color: '#fff', flatShading: true, emissive: '#70f5ff', emissiveIntensity: 0 }),
    new THREE.MeshPhongMaterial({ color: '#fff', flatShading: true, emissive: '#0e35d3', emissiveIntensity: 0 })
  ];

  const mesh = new THREE.Mesh(geometry, materials);
  const mesh2 = new THREE.Mesh(geometry, materials);
  const group = new THREE.Group()
  
  //Caixa do texto
  const { x } = bbox(mesh).getSize(new THREE.Vector3(0,0,0))
  const planeGeo = new THREE.BoxGeometry( x + 10, 30, 5 );
  const planeMat1 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const planeMat3 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const planeMat4 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const planeMat2 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const planeMat5 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const planeMat6 = new THREE.MeshStandardMaterial( {color: '#0c3d59', side: THREE.DoubleSide, emissive: '#70f5ff', emissiveIntensity: 0} );
  const plane = new THREE.Mesh( planeGeo, [planeMat1,planeMat2,planeMat3,planeMat4,planeMat5,planeMat6] );


  //Reposiciona todos os textos no centro
  mesh2.rotation.y = degreesToRadians(-180)
  reCenterText(mesh2)
  reCenterText(mesh)
  
  //Um para a frente e outro para trás
  mesh2.position.z -= 5
  mesh.position.z += 5

  group.add(mesh)
  group.add(mesh2)
  group.add(plane)
  return group;
}

Original without composer:

The result:

I can have a look at this issue. Would you mind demonstrating it with a live example though? I’ve prepared a fiddle for you that holds the code of the official bloom demo: three.js dev template - module - JSFiddle - Code Playground

Try to modify the code such that the issue can easily reproduced.

Ok! i’ll try

1 Like

Hi! @Mugen87

I managed to reproduce quite simillar, but i cant get the exact effect… if you can tell me something to loook for and maybe try to reproduce it… i dont know what happened

Something i found weird was the strange glow the spheres have, even though i did not specify emissiveness to them.

OBS: Even if i do not renderpass the bloompass, only render and outputpass, the effect is still the same but without glow.

The flicker I can see in the fiddle is related to aliasing. Rendering at the native resolution noticeable improves the result at least on my macMini. I have just added renderer.setPixelRatio( window.devicePixelRatio ); to the code.

Does this improve the rendering of the text on your machine as well?

That’s the result for me:

You have the same?

Can you please try it again? I’ve accidentally saved the fiddle without the new line of code :innocent: .

The result is the same… something i did?

I tryied pixel ration in my project as well, id did not make a difference. any advices?

Maybe this is also related to the depth precision since your scene has a large scale. How does this fiddle look on your machine? three.js dev template - module - JSFiddle - Code Playground

This one is the same as the previoues one.

Its worth pointing that a high zoom get as more rendered image with less aliasing.
The same idea applies to my project, but he gets way more blurred and aliased than the fiddle.

Your fiddle with zoom:

@Mugen87 Do you think its something to do with the antialias while using postprocessing?

@Mugen87 Looking at my scene creation, i realized something after you said about pixelratio.

The order i was doing things messed all up.
The solution was:

  1. First of all, set size and pixelRatio to the renderer as @Mugen87 said
  2. After that, the postprocessing should be applied only after the changes to the renderer are applied, otherwise it become all messy

And now i have the clean bloom effect, thank you @Mugen87

1 Like