PDA

View Full Version : cross-sections with overlap



hifuGL
03-16-2006, 08:04 AM
The title kind of says it all; i need to show a sliced cross section of my geometry.

So far i'm using the clip plane and stencil buffer (with GL_INVERT) together for this. That generates the right cross section, and looks pretty good, as long as nothing overlaps.

When things do overlap, it of course double-inverts, causing the overlapped areas to be turned off. So far i can't fix this without it getting messed up by various solids that are not clipped (ie not part of the desired cross section)

Does anyone here know some stencil buffer magic (or any approach i guess) to ignore anything not cut by the clip plane, but also properly handle overlapping geometry?

sqrt[-1]
03-16-2006, 02:21 PM
Not sure how exactly the "invert" method works, but have you had a look at what the ATI demo does?

http://www.ati.com/developer/sdk/RadeonSDK/Html/Samples/OpenGL/RadeonVolumeTexture.html

Seems to be:

- Enable clip plane

- Draw all front faces

- Draw all back faces setting stencil = 1 where rendered

- Draw a quad on the cutting plane where stencil == 1

- Reset stencil

(of course I don't really understand what you are doing, so this may not be useful to you)