I see a lot of projects using CopyShader
at the end of a post-processing chain. I cannot find any documentation of it on Three.js. What does it do exactly? Additionally, why is setRenderTarget
necessary here? If removed, the effects are not applied. But if it is included, then it will 'freeze' an a-scene
in place, stopping all animations. I am able to use tick
and setInterval
to resume the animation, but the performance takes a huge hit.
For example:
var composer = new THREE.EffectComposer( renderer );
renderer.setRenderTarget( composer.readBuffer );
var renderPass = new THREE.RenderPass( scene, camera );
var copyPass = new THREE.ShaderPass( CopyShader );
composer.addPass( renderPass );
var vignettePass = new ShaderPass( VignetteShader );
vignettePass.uniforms[ "darkness" ].value = 1.0;
composer.addPass( vignettePass );
composer.addPass( copyPass );
composer.render();
this.composer = composer; // To run as composer.render()