How to use EffectComposer with multiple layers?

i would avoid layers at all cost, it makes the app implicit and hard to control, to me layers is go-to for threejs. in most cases layers are not needed.

as for stencil in effectcomposer, it wont work ootb. @gkjohnson explains the issue here: Clipping Stencil - #4 by gkjohnson if you fork the effect and work around the issue with the overridematerial it would be ok IF you enable stencil on all the buffers (the effect composers buffer and the buffers that the passes create).

now, solutions, …, as usual, the postprocessing library proves to be a better alternative to jsm/effectcomposer, it supports stencil for most (all?) effects.

i also think you’re going through way too much trouble for these stencils, there are super easy abstractions in drei that take care of it.

3 Likes