you can’t. or, it can’t. you have to write your own implementation.
or, pair threejs with react and it’s done:
this is actual occlusion, the html is practically part of your scene and can be sandwiched between 3d objects. it can even receive shadows and reflections. and without dirty tricks or expensive raycasting.
the planegeo + noblending material will stamp a hole into the canvas, it has to be exactly where the html is supposed to be. the html of course lurks behind the canvas and must be css3d transformed properly. if the hole and the html lines up you get natural occlusion with rectangular shapes.
if you need exotic shapes that’s possible, too (see the round corners in the first demo) but you need to make the geometry reflect that.