How to get the correct color value using unrealbloom?

On the left is the scene without unrealbloom, and the color is brighter

composer1 = new EffectComposer(renderer);
composer1.renderTarget1.texture.encoding = THREE.sRGBEncoding;
composer1.renderTarget2.texture.encoding = THREE.sRGBEncoding;

On the right side, unrealbloom is used to darken the color. How to use unrealbloom to make the color the same as that on the left side?

composer2 = new EffectComposer(renderer);
finalPass = new ShaderPass(
        new THREE.ShaderMaterial({
          uniforms: {
            baseTexture: {
              value: null
            bloomTexture: {
              value: composer2.renderTarget2.texture
          vertexShader: vertexshader,
          fragmentShader: fragmentshader,
          defines: {}
        }), 'baseTexture'
finalPass.needsSwap = false;

finalComposer = new EffectComposer(renderer)

I tried to set encoding property of finalcomposer, but it didn’t seem to take effect

finalComposer.renderTarget2.texture.encoding = THREE.sRGBEncoding

Try change gama fator or light intensity
on creating renderer set:

renderer.toneMappingExposure = 1;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.gammaFactor = 2.2; //change if too light

Yes, I have set the outputencoding property of the renderer, but this does not get the correct color.

The bloom pass effects the entire scene by default. I suggest you apply the effect selectively like demonstrated in the following example: three.js webgl - postprocessing - unreal bloom selective

:face_with_monocle:You may misunderstand what I mean. I am using this example now. I want to make the final rendered output color space sRGB, making the color brighter.

Oh, I see. Try adding an additional ShaderPass using GammaCorrectionShader at the end of your pass chain like in webgl_postprocessing_ssr.


Wow, that’s great. Set the gammacorrectionshader and the color will be correct

const finalComposer = new EffectComposer(renderer);
finalComposer.addPass( new ShaderPass( GammaCorrectionShader ) )

After using gammacorrectionshader, there will be a serious ribbon problem. I found a solution in other posts you replied to. Is my use correct?

const parameters = {
      minFilter: THREE.LinearFilter,
      magFilter: THREE.LinearFilter,
      format: THREE.RGBAFormat,
      type: THREE.FloatType,
      stencilBuffer: false
const target = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, parameters)
const finalComposer = new EffectComposer(renderer, target);
finalComposer.addPass(new ShaderPass(GammaCorrectionShader))

The default data type of the render target (UnsignedByteType) is not sufficient so using floating point should mitigate the issue. You might check if THREE.HalfFloatType works for your use case.

Halffloattype and floattype look the same. Will this affect the frame rate?

Half float is more performant.