Clipping Stencil

Does clipping stencil work with Effect composer renderer?

1 Like

It depends on the effects used and whether they render the scene again for more information (depth, normals, etc) and whether they take stencil state into account. Which effects are you using?

I am using Outline effect @gkjohnson

It likely does not work with stencils out of the box. You’ll have to modify the OutlinePass to do what you want.

Right now Scene.overrideMaterial does not respect original material settings so the stencil properties are not used when rendering the color pass for outlines. Issue 14577 for a feature to handle this generally but it’s a complicated problem. I suggest editing the pass for your use case.

1 Like

Hello again @gkjohnson, is it possible you give me a hint on how to modify he outline pass to support clipping stencil?

give me a hint on how to modify he outline pass to support clipping stencil?

Sure! At the core the the issue is that scene.overrideMaterial uses the same material for all objects in the scene which means the original materials stencil settings are not used which means you cannot use overrideMaterial. Instead you’ll probably have to traverse the scene and create new materials for each object with the appropriate settings and set it before rendering. And then you’ll have to replace the original material on the object after rendering then. You should cache the materials between renders so you don’t have to create new materials every frame, as well.

Hope that helps!