pouët.net

3D Meshes and CSG operations

category: code [glöplog]
 
How to realize CSG operations in 3D mesh objects? Please, discuss the principles.
added on the 2011-02-24 16:15:59 by Danguafer Danguafer
Depends.exe on what you are doing.
3D mesh objects as in triangle meshes? I guess there are tons of papers on that topic and a lot of different approaches... google it.
Or just take distance fields instead - in distance fields CSG is trivial ;)
added on the 2011-02-24 16:52:25 by las las
Clip the triangles against each other, check inside/outside rules for each resulting polygon. Simple in theory, but turns into absolute hell in reality due to floating point accuracy. There's a reason why there's very few CSG-packages out there that can eat it's own dog-food.
added on the 2011-02-24 17:04:16 by kusma kusma
Maybe an easier place to start: Screen Space CSG?
added on the 2011-02-24 17:50:45 by revival revival
added on the 2011-02-24 17:54:08 by eyebex eyebex
Indeed, screen-space CSG is much easier to get robust.
added on the 2011-02-24 17:57:50 by kusma kusma
This reminds me.. I wonder if anyone ever made a .pov ---> random-polygon-object-format converter, e.g. something that would eat povray's script (even with limited set of primites) and output an approximation as a mesh.
added on the 2011-02-24 20:45:39 by uncle-x uncle-x
Just a first random pick... http://www.nigels.com/research/ there's really a huge amount of academic research out there...
Or if you wanna just cut out planes, you have it nearly for free in OpenGL, see for instance http://www.cs.duke.edu/courses/fall00/cps124/web/links.html.
Hmm, distance functions are lovely...
must... download... framework... and play!
added on the 2011-02-24 21:36:18 by bdk bdk
The easiest one to implement is:

http://www.opengl.org/resources/code/samples/advanced/advanced97/notes/node11. html
Easy peasy. Intersect all edges of mesh A with triangles of mesh B and vice versa. Then just connect the dots :)

Bonus points doing the intersection stuff so that each pair or triangles intersect at either 0 or 2 points, retriangulating without nasty singularities and getting intuitive results on non-perfect input meshes.
added on the 2011-02-25 15:03:16 by 216 216
bsp trees will help you with csg:

A Tutorial on Binary Space Partitioning Trees
BSP FAQ
flipcode article

also there's example code in Game Programming Gems 5, if you need it, I'll send you the source code
added on the 2011-02-27 18:17:44 by Ized Ized
Weeks struggling for a stable connection...
Thanks for the answers.

Ized: Would you mail me it? dang...@gmail.com
added on the 2011-03-11 22:51:36 by Danguafer Danguafer
added on the 2011-03-16 16:31:19 by bdk bdk
with something resembling to an authority, i can confirm that you really don't want to code triangle-mesh CSG yourself. However, if you still insist to do it, I can recommend 216's method above :)
added on the 2011-03-16 21:47:53 by blala blala
I need it and I want it. D:
added on the 2011-03-16 22:41:06 by Danguafer Danguafer

login