Jump to content
  • Advertisement
Sign in to follow this  
MrSparkle27

OpenGL Optimizing the triangulation

This topic is 3667 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

Hi! I implemented the Cutting-Ear-Algorithm to triangulate any convex or concave polygon. The result is pretty good but sometimes there are some very thin triangles due to how the algorithm works. Is it recommended to optimize the triangulation or doesn't it really matters when rendering with DirectX or OpenGL? Which would be the best way to optimize the triangulation? Currently I try to compare the bounding circles of all adjoining triangles. If a triangule is completely in a bounding circle of another triangle I swap the segment between both triangles. This works pretty good but is much slower than the triangulation itself, and I'm still not sure if it's really worth it. Christian

Share this post


Link to post
Share on other sites
Advertisement
Are you talking about optimising the algorithm, or optimising the resultant triangles for Direct3D/OpenGL?

Share this post


Link to post
Share on other sites
This is the result so far, it creates a nice triangulation but it's still very slow at the moment. As you can see the long, thin triangles are replaced. I'm not sure if this is really appropriate.

Before optimization:


After optimization:


[Edited by - MrSparkle27 on July 28, 2008 2:20:53 PM]

Share this post


Link to post
Share on other sites
Do you want to do this real-time? If not, there will of course be no harm in trying to reduce the amount of triangles while preserving the shape. But if you are doing it real-time, it will be hard to cut out a few extra triangles and render it faster than it will be to just render it all.

Share this post


Link to post
Share on other sites
Nope, I don't want to reduce the number of triangles. I just want to optimize the shape of the triangles.

The Cutting Ear algorithm can produce very thin triangles but I'm not sure if this could affect the output when rendering the mesh with DirectX or OpenGL.

In a 3d modelling program like 3ds max, it's always best to optimize the triangulation of the meshes to avoid ugly artefacts during rendering.

My question is wether it is recommended to optimize the triangulation or just waste of time.

Thanks,
Christian

PS: How can I include images to my postings?

Share this post


Link to post
Share on other sites
As long as you do flat-shading, it is probably no gain in optimizing it. But as soon as you do any pr. vertex normal stuff, I believe long narrow triangles will give you artifacts.

Share this post


Link to post
Share on other sites
Yes, you may be right. I also thought about texture coordinates. I guess the interpolation of the uv coordinates along the long edges can result in really ugly distortion of the textures. Maybe it's really worth to implement a mesh optimizer though.

Share this post


Link to post
Share on other sites
How did you optimize the triangles (as shown in your two photos) ? Which method are you using ?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!