Jump to content
  • Advertisement
Sign in to follow this  

How to detect hollow openings/holes on a static mesh?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I start thinking about it,
I would start with the sum of dot products around a loop is zero
when there are only 4 edges, each of them facing each other.
But this is too naive, because some openings may have more than 4 edges,
that form a hexagon for example.
How do I detect all hollow openings on my static mesh, like wells.

Share this post

Link to post
Share on other sites

Build a data structure where each edge points to it's two triangles and each vertex has a list of it's edges.

Build a list containing all edges with one triangle pointer empty (open edges) an a flag per edge.


1. Start a new hole by taking an unmarked edge from the list.

2. Add the edge to the hole and mark the edge. Pick one of its vertices and loop over all its edges: Find another open edge from it, this must be the next edge at the same hole. Continue (always using the other yet unvisited vertex) until you get back to the initial edge. The hole is done.

3. Continue with step 1 until all open edges has been marked and all holes are found.


It's really simple and fast but you need meshes without bugs (double edges or whatever).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!