Let's say I have a terrain mesh of some triangles, and several smaller meshes which I want to add to that terrain mesh (think ground and some small mounds or berms for example). What would I look for to find algorithms to let me do this? I know it's like some kind of computational geometry but I wonder if anyone might know search terms or even better urls to look at. Ideally I would like to do this on the fly to simplify drawing of a terrain where the basic ground and the detailed "interesting" bits are stored separately. Right now we draw the ground and the other parts separately which is less than ideal.
-
\$\begingroup\$ What's wrong with just sticking your detail meshes at the end of the mesh data and connecting them with a degenerate triangle or two? \$\endgroup\$– TetradJul 20, 2011 at 20:01
-
\$\begingroup\$ Overlaps are possible. \$\endgroup\$– ahwulfJul 20, 2011 at 20:14
-
\$\begingroup\$ When you say overlaps what do you mean? Like visual problems? It shouldn't look any different than just drawing thing separately. I wouldn't recommend taking a heightmap-style terrain and physically cutting it up to insert details. You'd get a lot more triangles out of the end result when you could just doing a naive batch and eat the overdraw. \$\endgroup\$– TetradJul 20, 2011 at 20:22
-
\$\begingroup\$ I think he's looking to 'merge' terrain features into the terrain mesh, so there's no 'visible' separation. Which would be very difficult, high processing cost and you'd have a tricky time with texturing. \$\endgroup\$– hiddensunset4Jul 21, 2011 at 3:22
-
\$\begingroup\$ This is why we place doodads right? That's how most games does it at least. \$\endgroup\$– NailerJul 21, 2011 at 13:25
1 Answer
I think the term you are look for is CSG, or constructive solid geometry. There are basically three different operations: boolean union, boolean intersection, and boolean difference. You need the boolean union to merge two overlapping meshes into one. I'm sure you'll be able find some useful information with those terms.
Some links to get you started:
-
\$\begingroup\$ I'll take a look, thanks. I also thought later than one could do a delauney triangulation on all the points, then re-add the height values. I think this might work since this is terrain type things I am merging. \$\endgroup\$– ahwulfJul 21, 2011 at 16:22