多个EffectComposer可以在同一个WebGLRender中渲染吗?

时间:2016-05-05 04:40:07

标签: javascript three.js

可以在同一个WebGLRender中渲染多个EffectComposer吗?

codepen demo

这是我的代码,它不起作用。但是renderer.render()没问题,没有效果。 有人可以调试我的代码吗?

var renderer;
var scene1, scene2;
var camera;
var geometry1, geometry2;
var FilmShader; 
var composer1, composer2;

scene1.add(geometry1);
scene2.add(geometry2);

var renderPass1 = new THREE.RenderPass( scene1, camera );
var renderPass2 = new THREE.RenderPass( scene2, camera );
var filmPass = new THREE.ShaderPass( THREE.FilmShader );

composer1 = new THREE.EffectComposer(renderer);
composer2 = new THREE.EffectComposer(renderer);

composer1.addPass(renderPass1);
composer1.addPass(filmPass);
composer2.addPass(renderPass2);
composer2.addPass(filmPass);

// It's not work, just render composer2(or composer2 cover composer1)
composer1.render();
composer2.render();

// It's ok, but on effect
renderer.autoClear = false;
renderer.render(scene1, camera);
renderer.render(scene2, camera);

0 个答案:

没有答案