EffectComposer second pass “overwrites” first pass

拜拜、爱过 提交于 2020-01-05 03:08:11

问题


i want to render a texture on the background and the 3dscene in the foreground. i used the effectcomposer to do this.

how ever my first pass (the background) seems to be "overwritten" with the 2nd pass (the scene) the result only the scene gets drawn with a black background. it looks like the background of the second pass isnt drawn transparent or the transparancy is lost.

http://jsfiddle.net/mdwzx1f8/8/

var renderTex = new THREE.TexturePass(myTex);
var renderScene = new THREE.RenderPass(scene, camera);

composer.addPass(renderTex);
composer.addPass(renderScene);

var effectCopy = new THREE.ShaderPass(THREE.CopyShader);
effectCopy.renderToScreen = true;
composer.addPass(effectCopy);

i hope someone can take a quick look at it and point me in the right direction

thanks in advance


Updates:

07/07/2015

  • I tried clearing the zbuffer with renderer.clear(false, true, false);

  • Found a post on masking which i looked at but it wasnt added to
    threejs as far as i can tell
    https://github.com/mrdoob/three.js/issues/2448

08/07/2015

  • Found another interesting page https://github.com/mrdoob/three.js/issues/5979 not sure if this is related yet
  • Updated the fiddle if you comment line 53 you will see the 1st pass which should be visible if the scene background is drawn transparent

回答1:


Bobafett in the threejs irc channel helped me out and he found my issue, it turns out that i called: renderer.autoClear = false; instead onrenderer.autoClearColor = false;

Here is the modified and working fiddle: http://jsfiddle.net/mdwzx1f8/9/

I would like to thank all who have helped me in the search for the solution



来源:https://stackoverflow.com/questions/31181748/effectcomposer-second-pass-overwrites-first-pass

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!