Using depth + mask-image as a way to occlude css3D elements

As I said in the tittle, this is 100% doable as R3F users been doing it for a while, so how we would do to achieve something similar in plain THREE?

image