About Store Forum Documentation Contact
Donations:
289$/mo



Post Reply 
Mesh Optimization (Floating Triangles)
Author Message
Driklyn Offline
Member

Post: #1
Mesh Optimization (Floating Triangles)
Is it possible to remove floating triangles (I guess that's what you'd call them) from a mesh? See below. The triangles I am talking about are highlighted in red.

Any triangle that is not fully connected to another (i.e. you can see through one side of the triangle, depending on the camera angle) needs to go!

   
(This post was last modified: 09-29-2011 08:49 AM by Driklyn.)
09-29-2011 08:47 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Mesh Optimization (Floating Triangles)
Is this possible? I'm pretty sure this will solve the problem I am having if I can programmatically remove "floating triangles".
10-02-2011 08:34 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Mesh Optimization (Floating Triangles)
you can do it in the Model Editor (alt+LMB to select a poly group) and delete it
as for programatic:
MeshBase::removeFace(Memc<Int> &sel); // remove selected faces, here the 'sel' index can point to both triangles and quads, if face is a triangle then 'sel=triangle_index', if face is a quad then 'sel=quad_index^SIGN_BIT'

but the 'sel' selection you need to specify manually
10-02-2011 09:57 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Mesh Optimization (Floating Triangles)
Any ideas on how would I go about detecting the triangles that need to be removed?

I am using CSG to dynamically cut a hole in the wall, with the purpose being to create a tunnel that you can walk through.

Imagine firing a rocket launcher into a wall. I am dynamically creating boxes where the impact takes place and then removing the explosion part from that box and any other boxes that it intersects with. Trouble is, I get the occasional floating triangle like in the screenshot in the first post, or the walls of new boxes aren't being removed where they intersect with the walls of other boxes (both walls share the same location, but have opposite normals).

The list below describes each of the 4 screenshots in the attachment below:

  1. Front view of the tunnel (just so you can get a better idea of what I'm talking about).
  2. Side angle of the 3 boxes that make up the tunnel (each box is a separate color).
  3. Rendering just the first box and its actor.
  4. Rendering the third box and its actor. You can see that where the wall of the first box meets with the wall of the third box, the triangles are not deleted, though they need to be. I having tried setting 'detect_self_intersections' to true in the Csg function, but I don't think this is consider a self intersection.


   
10-02-2011 10:51 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #5
RE: Mesh Optimization (Floating Triangles)
So I picked up this little side project of mine again and finally figured out how to create tunnels using CSG properly. I tried about 8 different techniques before I figured out the best way, and it's actually the easiest to do.

Now I was hoping to be able to figure out how to detect "floating chunks" in the mesh itself. Not sure how hard this will be to do, but I know it most be possible to do (in real-time even) because the game, Red Faction, does it (I'm creating a little clone of it). I'm just not sure what the algorithm is called, so it's hard to find what I'm looking for on Google.

Anyone have any ideas?

Never did figure out how to detect "floating triangles", but I no longer have the need as the technique I am using now for creating tunnels virtually never creates a floating triangle.

----------

EDIT: To clarify, I would like to detect the floating chunk and create a dynamic actor out of it so it falls to the ground. This does indeed happen in the game Red Faction (the original version even, a 10-year-old game).


Attached File(s) Image(s)
   
(This post was last modified: 11-10-2011 08:53 PM by Driklyn.)
11-10-2011 08:48 PM
Find all posts by this user Quote this message in a reply
Post Reply