Three.js渲染多个作曲家

时间:2018-07-12 11:01:42

标签: javascript three.js rendering shader

我试图渲染多个作曲家,如:

var wt = new THREE.WebGLRenderTarget( Width, Height, rtParameters);
var composer = new THREE.EffectComposer(renderer, wt);
var renderPass =  new THREE.RenderPass(part_of_scene, camera);
composer.addPass(renderPass);



var wt2 = new THREE.WebGLRenderTarget( Width, Height, rtParameters);
var composer2 = new THREE.EffectComposer(renderer, wt2);
var renderPass2 =  new THREE.RenderPass(another_part_of_scene, camera);
composer2.addPass(renderPass2);

以及两个renderpass:

renderPass.clear = false;
renderPass.clearDepth = true;


var effect1 = new THREE.ShaderPass(blur_shader);
effect1.renderToScreen = true;
composer1.addPass(effect);

var effect2 = new THREE.ShaderPass(sepia_shader);
effect2.renderToScreen = true;
composer2.addPass(effect);

以及在渲染循环中:

composer1.render(delta);
composer2.render(delta);

问题是只有composer2可以渲染,而且我认为当我//composer2.render(delta); composer1正常渲染时,它会在composer1上方渲染,因此我在问为什么这种行为?以及如何在不清除composer1的情况下在composer1之上渲染composer2,我的意思是我希望它们都出现。

0 个答案:

没有答案