Author Topic: Realtime CSG... almost there!  (Read 12298 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Realtime CSG... how about no
if you recoded the BSP to use an actual tree structure, and wrote code to rebuild that tree structure on the fly, you could put this in FSO.

note: this is actually not as hard as it sounds.
but for performance reasons you would have to run this in a separate thread.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Realtime CSG... how about no
It looks great:



But there's lots of slivery triangles I gotta get rid of:



...preferably without screwing up my UV coordinates or vertex normals. There's a few other things I oughtta fix up, too.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Realtime CSG... how about no
pretty cool, but is there any way to stop all the new tris from sharing the same vert? aparently it causes some smoothing and normal maping issues. on the other hand it looks ok from your renderer.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: Realtime CSG... how about no
Nope, not unless you add more vertices in the parent mesh for them to link to.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Realtime CSG... how about no
Well, I could possibly make some sort of polygon reduction algorithm. Or I could add some more verts along the edges... it'd make more triangles total, but they'd be less squashed.

I think the reason mine still looks good is because I'm not re-generating the vertex normal vectors. All of the vertex normals are either the ones from the original meshes, or are those but interpolated (specifically, taking a weighted average of the verts of the original mesh's triangles, and renormalizing it). A model editing program would probably generate the vertex normals after-the-fact, and probably as a flat (i.e. not weighted) average of the face normals surrounding the vertex, thus making it looks stupid. But that's just speculation on my part.

Edit: Or I could somehow combine the added verts with the poly-reduction thing... somehow.

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Realtime CSG... almost there!
Hm, idunno what to do next with this. There's a bunch of things that still need to be done, and I'm not entirely sure what order to do it, etc.

My un-ordered "TODO" list looks like this:

  • Speed up existing functionality
  • Rearrange the existing functions/classes (there's a bit of redundancy, I think)
  • Mesh optimization... Adding more verts to eliminate slivers? Removing unneeded edges? Keeping references to the original triangles/geometry (i.e. quasi- N-gons)?
  • Allow more kinds of generalization (without breaking existing stuff)
  • Support for more than two operands simultaneously?
  • Other stuff?

Advice is welcome!
« Last Edit: April 30, 2010, 06:54:52 pm by Aardwolf »

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Realtime CSG... almost there!
Thread-bump!

My interest in this project is somehow renewed. I've asked a bunch of people I know if they're interested in collaborating on this. Obviously no replies yet.

Edit: Oh hey, I put it on Google Code.
« Last Edit: May 24, 2010, 04:41:46 pm by Aardwolf »

  

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Realtime CSG... almost there!
just as a stress test, why don't you code up a test where a bunch of random objects are placed randomly then added subtracted from each other.

also a feature you might want to look into is determining if an object has been split into two objects.

multithreading is also another thing you should be making sure is safe.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Realtime CSG... almost there!
Checking if it's been split into more than one piece? Actually, I think that's almost already in there. That is, it's already finding regions of contiguous faces (stopping when it runs into a cut), and then determining whether those regions are on the correct side of the other object. It probably wouldn't be too hard to modify the code to check for that.

But there's still some major refactoring that needs to be done, and I'm not sure whether that feature is something that should come before or after the refactoring.

By the way, since it's now on Google Code, anyone can check it out. So if anybody wants to become a contributor1 or a committer2, shoot me a PM.






1Lets you comment on the Wiki, Issues, etc. (I think)
2Lets you commit SVN changes