• Advertisement
Sign in to follow this  

CSG algorithms?

This topic is 4404 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm creating an editor for 3D games and I would like to use CSG to build the basic geometry. What I need is to find some pseudo code and/or detailed description over the various operations (union, difference, intersection, complement). I know what they do, but not exactly how. I could probably build the functions, but it's foolish to reinvent the wheel... :) I'm not interested in real time CSG (which is what you find with google). Any ideas is helpful? // Javelin

Share this post


Link to post
Share on other sites
Advertisement
Hehe... I was already reading it when I got your reply. The article seems very useful.

Thanks

Share this post


Link to post
Share on other sites
I've implemented CSG a few times, and my suggestion is DON'T USE THE BSP METHOD! For complex models it causes excessive splitting and it's slow compared to the method I used last (at least as far as I can write it).

The last time I did this I used a combination of two things: Icoseptrees and this CSG algorithm. I tested the icoseptree against an octree and it won comfortably. The only thing about Laidlaw's CSG paper is it's very complicated an involves storing a lot of connectivity data and ensuring there are no T-junctions. I didn't do any of that in the end - I allowed T-junctions and tested whether a point was inside/outside by raycasting as in the paper but I didn't bother using connectivity information, which meant I just stored a linked list of polygons in each leaf of the tree, and my polygons were just an array of points. I've tried implementing all the edge connectivity stuff before, and basically I eventually came to the conclusion that it's nowhere near worth it in performance or any other terms - if you need a connected model stitch it all back together when you're done with CSG.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement