PDA

View Full Version : Volume Intersection Problem



MaxH
11-13-2008, 12:27 PM
I would like to be able to show which parts of a polygonal model lie within an ellipsoidal volume. I'm hoping this can be done with a multi-pass rendering involving stencil operations. Can anyone point me to a tutorial similar to what I'm trying to do? Reading the documentation on stencil planes and stencil operations is not good enough (for me). I need to see code or pseudo-code that does something similar to the problem I'm trying to solve. Thanks.

ZbuffeR
11-13-2008, 12:37 PM
http://www.opencsg.org/

trinitrotoluene
11-13-2008, 06:31 PM
In the case you don't want to link again a third party library, see this source code (http://www.cosc.brocku.ca/Offerings/3P98/course/OpenGL/glut-3.7/progs/advanced/csg.c).The functions that may interest you in the file are firstInsideSecond,fixDepth,and.

MaxH
11-14-2008, 10:49 AM
Thanks for posting that code. It is better for me than using a library of canned routines because I may actually learn how to use stencil operations to accomplish my goal. I'll play with the code this weekend to see if I can figure out how to accomplish my objective.

MaxH
11-15-2008, 12:58 AM
I have brought that sample code onto my home PC, compiled, and run it successfully. It's an excellent demo. Next I have to try and figure out how it works :)

nigels
11-17-2008, 11:06 AM
Draw a closed ellipsoid, toggling a stencil bit for each fragment that is in front of the z-buffer.
The stencil bits that are one have an odd number of ellipsoid surfaces in front of it, and therefore are inside the ellipsoid volume.

See also:
http://www.nigels.com/research/