嘿我试图将MaskPass示例与来自threejs.org/examples的GlitchPass示例结合起来但由于某种原因添加renderPass会破坏MaskPass。任何人都可以解释为什么会这样吗?
代码: `renderer = new THREE.WebGLRenderer({antialias:false}); renderer.setClearColor(0xe0e0e0); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth,window.innerHeight); renderer.autoClear = false; document.body.appendChild(renderer.domElement);
//
var clearPass = new THREE.ClearPass();
var clearMaskPass = new THREE.ClearMaskPass();
var maskPass1 = new THREE.MaskPass( scene1, camera );
var maskPass2 = new THREE.MaskPass( scene2, camera );
texture1 = new THREE.Texture(videoImage);
texture2 = new THREE.Texture(videoImage);
texture1.minFilter = THREE.LinearFilter;
texture1.magFilter = THREE.LinearFilter;
texture2.minFilter = THREE.LinearFilter;
texture2.magFilter = THREE.LinearFilter;
var texturePass1 = new THREE.TexturePass( texture1 );
var texturePass2 = new THREE.TexturePass( texture2 );
var outputPass = new THREE.ShaderPass( THREE.CopyShader );
outputPass.renderToScreen = true;
var parameters = {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBFormat,
stencilBuffer: true
};
var renderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, parameters );
composer = new THREE.EffectComposer( renderer, renderTarget, 1 );
composer.addPass( clearPass );
composer.addPass( maskPass1 );
composer.addPass( texturePass1 );
composer.addPass( clearMaskPass );
composer.addPass( maskPass2 );
composer.addPass( texturePass2 );
composer.addPass( clearMaskPass );
composer.addPass( outputPass );
// composer.addPass( new THREE.RenderPass( scene1, camera ) );
// glitchPass = new THREE.GlitchPass();
// glitchPass.renderToScreen = false;
// composer.addPass( glitchPass );`