http://jsfiddle.net/WNvDu/4/
This is easy when it creates a scene.
http://jsfiddle.net/WNvDu/3/
Uncomment the render with the texture below and I will get this. All 3 objects are black.
renderer.render( sceneToMask, camera, maskTexture, true );
renderer.render( scene, camera );
In the rendering of the texture scene, it has two objects, the others are outside, but not a donut in the middle. I am trying to mask two outgoing objects in a scene. You can see the render texture displayed on the ground when both renders are called in the render loop.
edit: If I make a new file Three.Mesh () instead of .clone (), it "works". http://jsfiddle.net/jK7JC/ But this does not work, because it is not a solution, it is a bad hack. There must be a way to clear the masks.
edit: I tried a lot of things after posting this. I tried using two separate renderings. I tried cloning objects. (as above). Most things just fail. Other things work, but will not work in production. I need a way to visualize the stencil buffer or something else that is selectively over which objects to render in the stencil or not. I can't even get the basic stencil buffer for rendering. I tried to take a look at MaskPass.js and I still can not understand.
source
share