CSG for tesselated objects

hi folk,

Is it possible to create a CSG binary-tree for tesselated objects. Simple demo will be appreciated.


What do you mean with “tesselated”? Where should there be a difference in creating that binary tree for tesselated and non-tesselated objects?

So, the answer would be: yes, and it is done the same way as everything else, too.


ok, you are right about that binary tree as long as the logic remains same for all solid boolean manipulations. I promise that I’ll not post a message after midnight. :slight_smile:

With tesselated, I meant objects(usually solids) created with gluTessCallbac,gluTessNormal,gluTessBeginContour etc procedures. Due to the fact that they have specific winding numbering, contours, vertex and rules it seems that its impossible to create combined objects(union, intersection, subtract) with them because there aren’t procedures/functions to manipulate. Generally boolean operation is implemented for solids comprised from meshes, So far I have nowhere seen demo for tesselated objects.

If I’m mistaken, entrypoint or simple demo(with tesselated objects) will be appreciated.


Ah, now it’s much clearer!

No, afaik it is not possible to create logical combinations of “tesselated” objects. (Of course it’s possible, but you would need to implement it all by yourself.)

What i did implement is CSG for general meshes using BSP-trees. I can tell you, it is no fun at all. It is pretty easy building the BSP-tree and doing CSG operations on them (merge, intersect, subtract) and it works great for simple objects. But the moment your objects become more complicated, especially when they are concave, it is imperative to have a PERFECT algorithm. The problem is however, that there is not a single source on the web, that explains those DETAILS. There are several cases, that are just “undefined” and you need to “find out” yourself.

I were not successful so far. I have attempted to program a CSG algorithm 2 times now, and have so far not succeeded in making it work in all cases.

I am told 3D Max has the same problem. CSG operations seem to be unreliable there, too. I took a look at Valve’s editor (Hammer). They “solve” the problem, by not creating concave objects. When you do CSG operations on meshes there, it creates several convex meshes and groups them into one object. This way the CSG algorithm never has to operate on concave objects, which results in a reliable implementation. However it creates much more objects / polygons, than necessary, which their level-compiler might remove later again.

I intend to program a CSG algorithm in a few weeks for the 3rd time, using the same approach Valve used. It is more important to have a reliable implementation, that just works, even if it creates more polygons than necessary.

Well, drifted off a bit there… :wink: But maybe my insights help you a bit, depends on what you planned to do.


Thanks in advance and sorry for beeing late in reply.

That’s very interesting, that if I have to implement these functions or if there aren’t intrinsic functions in OpenGL where is the sense of using it. As far as I yield it’s too hard to implement the CSG (well done for you to attempt to implement it). Basically, what I’m trying to do is something like that
cutting parts obliquely or with right angle, but the main object can be concave or convex depends on user entry.

It looks that I’ll follow that way, all the objects that I have created with tesselation will be changed to the meshes and manipulation of CSG will be more simple.


Well, all the functions in the glu library are meant to get you started more easily. They are not meant to be used by professionals, but by beginners. CSG is obviously an advanced thing and users who actually come so far to want to do CSG in their own programs, need to use other approaches anyway.

Do you have that 125 KB gif somewhere else? I don’t use rapidshit, all that captcha-mess is making me crazy. But i guess it’s not so important.