EffectComposer - Access the image created by the Composer

让人想犯罪 __ 提交于 2020-02-02 09:42:06

问题


I've got a question/problem regarding the EffectComposer.

What I'm trying to do: I try to split up all of the post-processing used in my App between multiple EffectComposers. I would like to be able to calculate e.g. 5 shaders in EffectComposer1, then take the image created by this composer and pass it back into a uniform in e.g. EffectComposer2. Both the geometry and the texture used in EffectComposer1 are suitable (in terms of their pixel-size) to be used as a uniform in EffectComposer2.

AFAIK, the EffectComposers write/readBuffer should hold the texture that would get rendered to screen if no effect is set to renderToScreen = true;.

If there are any more informations needed in order to resolve this issue, please let me know.

Regards, Michael

Using three.js r82


回答1:


Aaaaaaand we're done!

After testing around and finally, creating another issue on github, I was able to solve this issue.

I stuck with this for now, since it works like a absolute charm.

This is the code that I use to create my texture:

var firstOutput = document.getElementById("CanvasOne"); //Get the filled canvas;
var tmpTxt = new THREE.CanvasTexture(firstOutput); //Create the texture;

//Set both min- and magFilter to the correct filtering;
tmpTxt.magFilter = THREE.LinearFilter;
tmpTxt.minFilter = THREE.LinearFilter;
tmpTxt.generateMipmaps = false; //Set this to resolve the image dstortion;

Afterwards, I was able to use tmpTxt as a uniform.



来源:https://stackoverflow.com/questions/41271770/effectcomposer-access-the-image-created-by-the-composer

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