How to use stencil to do this effect!

I am making a card using stencil. I made a simple demo.
my demo

I want to do it like this👇
I don’t want it to be too complicated, I just want the cube to be freely accessible, how should I do it in threejs?
article

1 Like

I finally solved it!

I used a cube(colorWrite:false) to set stencilRef value

my demo2

I have a new problem when I continued to use post-processing. The stencil doesn’t work.

my demo3