I am trying to implement a Stencil Buffer with jMonkeyEngine and can’t find much in the way of documentation or any examples where someone has actually used one. I’ve searched through the javadoc but can’t figure out how to actually implement it. Any suggestions or guidance would be greatly appreciated.
If it helps, this is what I’m trying to do:
I am interested in rendering the intersection between two objects. I have defined two objects, which I have called blobs.
- A data blob (scene graph)
- A filter blob (stencil)
I only want to render the pixels within the overlap between these two blobs. That is, 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 simplified model the data blob is sphere, so that the intersection of the two blobs would result in the outline of a circle.
If I can get this working I hope to use a Mesh for the stencil (filter blob). One concern is that the Mesh that defines the stencil will be dynamic and needs to update in real time (i.e. in every frame). Could this be a problem? .