I am using jMonkey to draw 3D graphs in real time. I have defined two objects, which I have called blobs.

A data blob

a filter blob

I am interested in the interaction of these two blobs. I only want render the pixels of the data blob where it intersects with the filter blob.

To make things a little simpler I am starting off by limiting the filter blob to a plane that is defined by a value on the z axis. In my simple model the data blob is sphere, so that the intersection of the two blobs would result in the outline of a circle.

The filter blob will always be defined by a mathematical function.

My current think is this:

At the start of the rendering pipeline pass each pixel through a transformation matrix, such that if the x,y,z values of the pixel is not equal to the x,y,z of the filter function, set the z value of the pixel to -1. Then go through with the normal rendering process.

Is there a way to implement this sort of transformation matrix within the JME API, or do I have to do it with a direct call to openGL?

One problem I see with this approach is: rasterization might produce pixels that will have slightly different ZBuffer values and the equality test will always fail.