Sign in to follow this  
TheFallenOne

DX9 Ngon Handling (Mesh Creation)

Recommended Posts

Hey guys,

I've recently written my own custom Wavefront OBJ model importer (in C++) that creates a DX9 mesh based on the OBJ/MTL information supplied.

The only problem I'm having is with faces with more than 4 vertices (Ngons). I can handle quads just fine, but more than that I'm not 100% sure how I should handle it when creating a new mesh, and information seems to be pretty scarce on the web.

Does anyone have any pointers on where to start?

Share this post


Link to post
Share on other sites
You are basically looking for triangulation algorithms, and there are lots of them floating around. If the polygons are convex, then it can be fairly easy to generate triangles from them. You create a vertex with the average of all the other vertices positions. Then every two consecutive vertices plus the new center vertex form a triangle.

If the ngon is not convex, then it will be slightly more complicated - but still very much within grasp. What kind of geometry are you working with?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this