I want to know if my post-processing function is correct

Hi everyone! I’m a new Three.js learner and I’m really enjoying the process. I’m building a small web application and I’m not sure if I’m doing the post-processing right. I’ve read several threads and built my function but I’d like to be clear if I’m following the right path. Can anyone tell me if my function is correct? Thank you very much for your help.

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

    bokehPass = new BokehPass(scene, camera, {
        focus: 10,
        aperture: 0.00002,
        maxblur: 0.01,
    });
    bokehPass.enabled = false; 
    composer.addPass(bokehPass);

    const gammaCorrectionPass = new ShaderPass(GammaCorrectionShader);
    composer.addPass(gammaCorrectionPass);
    
    fxaaPass = new ShaderPass( FXAAShader );
    const pixelRatio = renderer.getPixelRatio();

    fxaaPass.material.uniforms[ 'resolution' ].value.x = 1 / ( container.offsetWidth * pixelRatio );
    fxaaPass.material.uniforms[ 'resolution' ].value.y = 1 / ( container.offsetHeight * pixelRatio );
    composer.addPass( fxaaPass );
    updateBokehEffect(cameraControls);
   renderer.outputColorSpace = THREE.SRGBColorSpace;
}

Just use it in a program. If the program works fine, the function most likely is also fine.

1 Like