🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[Difference between Quad and Triangle meshes]

Started by
3 comments, last by ogldev1 1 year, 11 months ago

Hello guys,

I hope you're all doing well.

I just can't get the difference between quad and triangle meshes (obj file).

Also, is there a way (like an online tool) to reformat a QUAD obj file to triangles ?

I found a tutorial on youtube on how to load an obj file using Qt. The obj file used was generated from Blender (appearently it's not a QUAD format)

Mine was downloaded from a certain site on the internet; I just wanted to see if the code works or not because I'm gonne use it in a project. So when I compile, I get an error which is “OBJ format is Quads, please re-format to triangles”.

Thank you all for your precious time and help.

Advertisement

Well, I think I'm going to use Blender for the conversion.

ogldev1 said:
I just can't get the difference between quad and triangle meshes (obj file).

GPUs can't render quads, so at some point conversation to triangles is necessary.
But usually we want to do this as late as possible, because quads have advantages in modeling and geometry processing.
The obvious advantage is that most parametric surfaces generate quads, and subdivision surfaces generate smoother results using quad dominant meshes.
The lesser obvious advantage is that primary and secondary curvature directions on any surface are normal to each other, so the edge flow of quads can represent local curvature more accurate than equiangular triangles. (While triangles give us smoother singularities than quads, so there is no clear winner.)

So that's some reasons why quad meshes will keep around.

Also, is there a way (like an online tool) to reformat a QUAD obj file to triangles ?

Any 3D modeling tool can do this for you. E.g. Blender, which can also be used to batch process many files.
At some point you may want to support more file formats than obj. E.g. to support multiple UV maps, skinning, etc. You may decide to use a import library like Assimp, which also can triangulate quads or polygons.

If you want to implement triangulation yourself, the question is which of the two options to split a quad to choose. An easy answer is to pick the shorter splitting edge, following the idea of Delauney Triangulation.
But often that's not really good and creates jaggy curvature. The better option is to calculate primary curvature direction of the quad and pick the edge closer to that. But calculating curvature directions is not trivial or easy, which is probably the reason all 3d modeling tools i ever tried sucked at triangulating quad meshes. Maybe they improved in recent years.

However, it's not that important, and the easy route is good enough i guess.

Thank you so much, That really helped.

This topic is closed to new replies.

Advertisement