ARKit + SceneKit - Real world object partially occluding AR View.

Hi,


I'd like to have an ARView in SceneKit that is partially occluded by a 3D object. Here's a layered example :


Layer 1 - AR Camera View

Layer 2 - Coloured rectangle that's placed on some real world surface (table)

Layer 3 - A mask that allows some of the AR view to come through the rectangle (defined at runtime by either the user or some logic).


Presumably this will require using the stencil buffer - anyone got any hints or pointers?