#### Archived

This topic is now archived and is closed to further replies.

# Real-time CSG

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

## Recommended Posts

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?

##### Share on other sites
yeah, first get a real-time raytracer. Then it''s easy!

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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...

##### Share on other sites
Damn. Anyway, thanks for the update!

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
http://john.slagel.com/Geomods.html

1. 1
2. 2
3. 3
Rutin
21
4. 4
frob
18
5. 5

• 33
• 13
• 10
• 10
• 12
• ### Forum Statistics

• Total Topics
632568
• Total Posts
3007119

×