Real-time CSG

Started by
13 comments, last by Hybrid 20 years, 3 months ago
Has anyone here attempted CSG in real-time? I saw a tech demo by Stan Melax of real-time CSG and was impressed by it''s speed, and am looking into doing it myself. I understand people always say use BSP trees for CSG, though I''m sure some sort of other tree would also give decent results if done properly. Has anyone got any tips or tricks for real-time CSG? Are there any common problems to be aware of?
Advertisement
yeah, first get a real-time raytracer. Then it''s easy!
If you do not need the resulting mesh from a CSG operation but only want the visualization, it can be achieved using a multipass approach involving both depth and stencil buffer. If you google for realtime CSG I believe you can find an OpenGL implementation of the algorithm.
i''ve been thinking about trying out real time CSG...

I found this but haven''t tested it out...

http://ciel.me.cmu.edu/soji/ysclass/ysclass.html

it''s a library and the blendshell seems like it would do the trick...

NAME:YsBlendShellDEFINITION:  YSRESULT YsBlendShell    (YsShell &NEWSHELL,     const YsShell &SH0,     const YsShell &SH1,     YSBOOLEANOPERATION BOOL=YSBOOLBLEND);RETURN:  YSOK    Successfully blended  YSERR   FailedDESCRIPTION:  This function blends two shells, SH0 and SH1. Not only blending,  this function also can perform boolean operations, OR(UNION),  MINUS(DIFFERENCE) and AND(INTERSECTION).  You can specify the type of boolean operation by the parameter BOOL.  The value of BOOL can be chosen from:    YSBOOLBLEND    YSBOOLAND    YSBOOLOR    YSBOOLMINUS  YSBOOLBLEND just blends two shells. All intersecting polygons are  slashed along intersecting lines.  YSBOOLAND takes the intersecting part of two shells.  YSBOOLOR adds two shells into one shell. All unnecessary polygons  ,those are inside the new shell, are eliminated.  YSBOOLMINUS will subtract SH1 from SH0.  All operations other than YSBOOLBLEND does not work if one or both  of two shells are not solid.  The result is set to NEWSHELL. 



Thanks for the replies. I need the resulting mesh not just the visualisation of it.

I''ll have to take a closer look at that YS class one, it certainly looks interesting.
Don''t know if you are still checking this...but I did get around to testing the YsClass...

Way too slow for real time...oh well, back to the drawing board...

Damn. Anyway, thanks for the update!
CSG sadly isn''t simply, but have you considered making the mesh changes with a thread in the background and faking the images via depth/stencil buffer while the mesh hasn''t been finalized yet.

I wrote functions for CSG once and that stuff definitely wasn''t real-time capable. As soon as CSG gets interesting - complex objects intersecting each other in non-trivial ways - you end up in a world of pain. Numerical inaccuracies, poly-counts beyond your worst fears.

As long as nobody puts a gun to my head and tells me "do it in CSG" I will try everything in my power to avoid it.
I may be getting older, but I refuse to grow up
Ideally the CSG operation would take place in 1 frame, but other less essential stuff could take place in the immediate frames after - such as detecting floating geometry or remaking the vertex and index arrays for rendering.
http://john.slagel.com/Geomods.html

This topic is closed to new replies.

Advertisement