PDA

View Full Version : Mesh Slicing using Stencil Buffer



Sundown
12-18-2008, 10:21 AM
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:

http://i206.photobucket.com/albums/bb191/llyrapcenydd/Image.png

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 (http://developer.amd.com/gpu/archive/Rage128SDKSampleCodeandDemos/StencilingonRage128withOpenGL/Pages/default.aspx). 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.