Mesh Slicing using Stencil Buffer

I’m attempting to write some code that essentially ‘slices’ through a scene and shows in a seperate window what the meshes would look like if solid:

In the scene above there are two sphere meshes, one behind the other. The transparent blue plane represents the actual ‘slice’, which is displayed on the right.

I’m using the stencil buffer to do this, using a technique very similar to that found here. However, the example only consider a single mesh.

The problem I have is that whilst this works perfectly fine in sillouette, I cannot recreate the colours correctly (which is something I need for tagging in order to post-process). The problem is clear - the red sphere projects onto the green sphere slice in the above image.

Can anyone tell me if this is even possible? Thanks for you help.