iDevGames Forums
Boolean Mesh Operations and Mesh-Based CSG - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Boolean Mesh Operations and Mesh-Based CSG (/thread-338.html)



Boolean Mesh Operations and Mesh-Based CSG - Oddity007 - Feb 13, 2010 01:15 PM

I've been trying to figure out how to convert a CSG tree to a mesh, so that I can export it to a .obj.

Unfortunately, while I can find a lot of code and tutorials out there that show how to directly render a CSG tree in image space, I come up dry when it comes to converting to a mesh. Well, that's not entirely true, I did look through Blender source, and failed at finding the responsible code. I imagine that it comes to finding intersections of faces and building a mesh from that, or subdividing and merging. I could always voxelize and back, although I would loose quite a bit of information in the process.


Boolean Mesh Operations and Mesh-Based CSG - OneSadCookie - Feb 13, 2010 01:25 PM

GTS can do it, and is LGPL: http://gts.sourceforge.net/
CGAL can probably do it, though the relevant part is probably GPL: http://www.cgal.org/

You can do it with any kind of spatial partitioning tree. There used to be a decent tutorial about doing it with BSP but I'm having no luck finding it right now :/


Boolean Mesh Operations and Mesh-Based CSG - Oddity007 - Feb 13, 2010 03:42 PM

I found this on BSPs http://www.cgafaq.info/wiki/BSP_boolean_operations
Now it looks like I'll have to figure out how to convert to BSP and back, which should be much more documented.