How does masking with EffectComposer work?
See original GitHub issueI spent awful lot of time with examples/webgl_postprocessing.html but I cannot figure out how to work with masks (EffectComposer, MaskPass, etc.). Maybe I think of them the wrong way - the photoshop way. I’m trying to achieve this:

I would expect usage like this
function init() {
// ...
// full render
renderSceneA = new THREE.RenderPass(sceneA, cameraA);
renderSceneB = new THREE.RenderPass(sceneB, cameraB);
// rendering masks
renderMaskA = new THREE.RenderPass(maskA, maskCameraA);
renderMaskB = new THREE.RenderPass(maskB, maskCameraB);
// MaskPass would crop the rendered scene with mask
// finalComposer would layer up the passes on each other
finalComposer.addPass(new THREE.MaskPass(renderSceneA, renderMaskA));
finalComposer.addPass(new THREE.MaskPass(renderSceneB, renderMaskB));
// ... render to screen etc.
}
function render() {
finalComposer.render();
}
When I understand this, I would be happy to write some example / tutorial / blogpost about it.
Issue Analytics
- State:
- Created 11 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
EffectComposer – three.js docs
The class manages a chain of post-processing passes to produce the final visual result. Post-processing passes are executed in order of their addition/insertion ......
Read more >three.js - Hide a part of an object using masks (EffectComposer)
The idea is the following : Create two scenes, the first containing the objects playing the role of the mask, the other with...
Read more >WebGL Masking & Composition - Medium
This works because the mask image is grayscale, so the RGB values are all equal. In shaders, color channels are interpreted as numbers ......
Read more >Masking with Stencil - CGwith3JS - Google Sites
In graphics, this operation (right) is called masking. In art work (left), this is called stenciling. Thus, OpenGL chooses the word "stencil" to...
Read more >EffectComposer masks + background image+ - Popular Blocks
EffectComposer masks + background image+ ... var stats = initStats(); // create a scene, that will hold all our elements such as objects, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The newly added
webgl_postprocessing_masking.htmlshould be a easier example to follow.Perfect! Thank you. For others at this time its in the dev branch