3d clipping/cut

For my current project, involving augmneted reality i want an actor to appear coming out of a (virtual) slot in my (real) table.

The Problem is: i need to hide/cut/clip away part of the actor (where it is covered by that slot). I made a quick sketch to explain better whatr i want to achieve:

On the left and right side are two different ways/objects illustrated, that should both do the trick, but i dont know how to make these clipping-objects invisible and hide/cut/clip away the part off the actor (panda) that is behind it.

Any ideas how to do that? Or is there a simpler way?

Sounds like you want a clipping plane. See NodePath.setClipPlane() and PlaneNode in the generated API specs.

David

i already experimented with th clippingplanes you described, the problem is the clipping-effect only occures when the actor intersects with the plane. I need it to clip when the model is behind the plane(s). Is this possible?

I made a bether illustration to describe the effect i am after:

The grey Object is the 3D-Object i want to hide/cut/clip, the desk is a real video picture which will be put into the background.

not terribly sure but wouldnt that be a good example for stencil buffers? i wanted to get the same effect onces. i ended up projecting the webcam-texture onto the object but i figured there must be cleaner weays to do this.

I agree, stencil buffers sound like the right thing to use here. A stencil buffer can be used to obscure everything except for a certain region in screen space.

David

You can also use the depth buffer. Just draw your geometry with color write disabled.

thank you guys, i read a bit into stencilbuffers and it seems that it can do what i want to archieve. Is there any advantage in using the depthbuffer instead the stencilbuffer?