For an AR type application, I would like to know:
Is it possible to 2D-subtract one WebGL 3D rendering from another, to make the background show through?
Example, as of 2012-07-22 CEST implemented purely with 2D canvas: Reality Builder (source)
Note that you can move the red block behind blocks shown in the photo. This is done as follows:
-
The red block is drawn.
-
globalCompositeOperationis set todestination-out. -
Blocks are drawn in the exact same positions as the blocks in the photo that are in front of the red block. Thereby they are subtracted from the red block.
You should be able to do some trickiness if you set the
material.opacityof the blocker object to0and render it first.