I have 2 EffectComposer - both rendering same scene but with different effects. I now want to copy final effect of EffectComposer 1 (-> this.composer) over to EffectComposer 2 (-> this.blendComposer)… I fail miserable!
Is there an example I could check or see how it is done right?
I thought I “just” use renderTarget of composer1 one as “input” (-> tComp) in a shader for composer2 … but #fail
this.blendComposer = new EffectComposer( this.renderer, blendRenderTarget );
this.blendComposer.addPass( new RenderPass( this.scene, this.camera ) );
let simpleCopyShader1 = {
uniforms: {
tDiffuse: { value: 0 },
tComp: { value:1 }
},
vertexShader: [
'varying vec2 vUv;',
'void main() {',
'vUv = uv;',
'gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',
'}',
].join('\n'),
fragmentShader: [
'uniform sampler2D tDiffuse;',
'uniform sampler2D tComp;',
'varying vec2 vUv;',
'void main() {',
'vec4 color = texture2D( tDiffuse, vUv );',
'vec4 color1 = texture2D( tComp, vUv );',
'gl_FragColor = color1;',
'}',
].join('\n'),
};
simpleCopyShader1.uniforms["tComp"].value = this.composer.renderTarget2;
let simpleCopyPass1 = new ShaderPass(simpleCopyShader1);
this.blendComposer.addPass( simpleCopyPass1 );