Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sRGBEncoding in not working in THREE.EffectComposer

Tags:

three.js

I'm trying to do post processing in threejs scene here I'm using EffectComposer for doing it but im not able to enble sRGBEncoding in renderTarget.

const renderTarget = new THREE.WebGLRenderTarget(
    sizes.width,
    sizes.height,
    {
        minFilter:THREE.LinearFilter,
        magFilter:THREE.LinearFilter,
        format:THREE.RGBAFormat,
        encoding:THREE.sRGBEncoding

    }
)

and my effectComposer is like that

const effectComposer = new EffectComposer(renderer,renderTarget);
effectComposer.setPixelRatio(Math.min(window.devicePixelRatio,2));
effectComposer.setSize(sizes.width,sizes.height)

but sRGBEncoding is not working

enter image description here

like image 901
ajay sharma Avatar asked Nov 02 '25 12:11

ajay sharma


1 Answers

When using post processing, use a gamma correction pass at the end of your pass chain. This will ensure a sRGB encoded output:

composer.addPass( new ShaderPass( GammaCorrectionShader ) );

Full example: https://threejs.org/examples/webgl_postprocessing_3dlut

like image 176
Mugen87 Avatar answered Nov 04 '25 17:11

Mugen87