clipping an area

I’m using panda3D since a little time and I’d like to know if there is something implemented in order to hide a part of a mesh. (maybe a clipping box).
For example, I have a rectangle and a circle who overlap. I detect the collision’s area and I’d like to hide the part of the rectangle which is inside this area. The circle must stay visible in this area and so the parts of the rectangle which are not in this area.

I tried to do something with the clipping plane but I only can hide something outside two clipping planes (not inside) and it hide all the other objects of the scene.


You can make a clipping plane affect only one particular object, instead of all the objects in the scene, by calling object.setClipPlane() instead of render.setClipPlane(). However, it is true that you can only clip the outside of a rectangular region using clipping planes; you can’t clip the inside of an acute angle.

Since your goal is to hide the part of the rectangle that is covered by the circle, you might be able to play games with draw order and the depth buffer. For instance, if you ensure the rectangle is drawn first (with something like rectangle.setBin(‘background’, 0)), you can then turn off depth write for the rectangle (rectangle.setDepthWrite(0)), and when the circle draws it will paint over whatever part covers the rectangle, even if it is behind the rectangle.


In fact, I take this case just for the example.
My goal is to do the same thing with 3D objects.

But thanks for the answer.