Jump to content
  • Advertisement
Sign in to follow this  
Vincent_M

OpenGL Quads vs. Triangles

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

My environment modeler was telling me that the engines she's used, such as Unity, accept geometry in batches of quads instead of triangles. I've always thought models were stored a in triangle lists. She also uses Headus to UV unwrap textures onto our OBJ models, but again, it only loads OBJ files as quads. This appears odd to me as most models should be stored as triangle lists or triangle strips. OpenGL supports quad rendering, but I do not think it's that efficient on most GPUs, and OpenGL ES doesn't support quads.


Which are better support-wise and performance-wise?

Share this post


Link to post
Share on other sites
Advertisement
for tessellation it makes sense to have quads, but in general you have rather just triangles, my engines also always 'support' triangles (like you said, loading .obj), but I convert them into triangles on load.

is there any reason that would prevent you from splitting a quad into two triangles?


Share this post


Link to post
Share on other sites
How artists author meshes and how you render them are independent. An artist can author with quads, and then you can just split those quads into triangles during export or mesh processing. You're almost always going to want to render with triangles, since that's what GPU's natively support.

Share this post


Link to post
Share on other sites
Tessellation doesn't need quads, it can slightly better than using triangles in some cases, but your GFX card will split quads to triangles in the end. I don't know what the overhead is in instruction cycles to split quads to triangles, but if you send triangles it won't need to split them up. Most likely the splitting takes almost 0 time anyway, but again its still something.

Share this post


Link to post
Share on other sites
I've thought about supporting more than triangle faces where faces can have over 3 defined triangles, but I'm a terrible with writing text parsing code. We can just re-drop it into 3DS Max and go from there.

Share this post


Link to post
Share on other sites

How artists author meshes and how you render them are independent.
that's not fully the case, you have always two ways to split a quad. imagin a plane with all vertices in diagonal from top left to bottom right, splitting the quads also along the topleft-bottomright border will give you one straight bump, splitting topright-bottomleft will give you a lot of peaks.
It's differently solved between content tools, I had it implemented based on what I saw in 3dsmax, but as the artist in my company used maya, they complained about quite some cases where it looks odd.
simplest solution is of course to triangulate in the content tools.
Tessellation doesn't need quads, it can slightly better than using triangles in some cases
.it can improve quality quite a lot if you use quads. the problem isn't just the pure triangle vs quad tessellation, but the usual smoothing that you apply. with just 3 'anchor' points, you won't have the smoothing of the mesh curvature like with 4 per primitive.you can of course try to use the same smoothing informations (e.g. based on nurbs data that you pass as constants), but then you end up with twice as many source primitives.
I don't know what the overhead is in instruction cycles to split quads to triangles, but if you send triangles it won't need to split them up. Most likely the splitting takes almost 0 time anyway, but again its still something.[/quote]from my experience it was faster to use quads than triangles if you don't use smoothing. if you use smoothing, it's faster to use triangles than quads, because you evaluate just 3/4 the data for triangles. but if you try to reach the same quality in both cases, you have more work on triangles and you end up way slower.


that's a sample of the quality difference you can get when tessellating with quads vs triangles
[attachment=6064:quadsvstri.jpg]

the problem is not that triangles were inferior, but if an artist creates tessellation content with quads, they don't validate it with triangles, this can have unpredicted results.


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!