6
\$\begingroup\$

I'm curious to know which is better for games: quads or triangles? Wouldn't quads be better for rendering performances and smoothing out tessellation?

\$\endgroup\$
  • 3
    \$\begingroup\$ Often quads are converted to two triangles. \$\endgroup\$ – MichaelHouse Nov 24 '13 at 21:55
  • \$\begingroup\$ Yeah I know - just was curious of wondering why Quad Tessellations would be better vs. Triangulated Meshes Tessellations. If Quad Tessellation were better at smoothing displacements... \$\endgroup\$ – SICGames2013 Nov 24 '13 at 22:26
20
\$\begingroup\$

Triangles, the reason is triangles' ratesrization algorithm is faster, and also natively supported in hardware. So it would be faster to convert one quad into two triangles and do the rasterization. Actually that is what happens when you draw a quad on modern graphics hardware.

So the question is what makes it faster ?

There are certain characteristics in the triangle that makes working with it simpler and faster:

  • Any three non colinear points form a triangle.
  • Every triangle forms a unique plane. Triangle points cannot be part of two planes at the same time, unlike a quads, which save us the trouble from dealing with degenerate cases like this:     Notice how the top quad in the middle vertices don't lay entirely in the same plane.

                                     enter image description here

  • Any shape can be broken down into triangles, and triangles can only be broken down into triangles(not counting the degenerate cases).
  • "Point in triangle test" is much simpler and faster than "point in polygon test" ( also called odd even test). The point in triangle test is done using the Barycentric coordinates which is the main reason why triangles are faster to rasterize. Which brings us to the next point.
  • Barycentric coordinates are not only useful for point in triangle test, but also for other interpolation operations, which are so common in computer graphics, color and texture coordinates to name few.

But I am still not convinced, quads ftw! We still need them..

Well, yes! It makes a lot of sense for artists to use quads. (I am not artist myself, but I did study arts- and I suck at it, weird?) Dealing with quads is more intuitive when modeling a 3D shape, providing texture coordinates is also much easier, but this doesn't deny the fact that you only need to deal with quads at the assets creation level, games and 3d engines usually need every bit of performance, so it would some kind of naivety to provide a sub-optimal structure of geometry to the GPU when it's doesn't really have any direct advantage, why use sub-optimal structure when we can take the best of each worlds? Quads at the assets creation level, and triangles at the engine level!

\$\endgroup\$
  • 2
    \$\begingroup\$ +1; The big ones I can remember offhand are that all 3 points are guaranteed to be on the same plane, and splitting a triangle always produces two more triangles. \$\endgroup\$ – Maximus Minimus Nov 24 '13 at 23:44
  • \$\begingroup\$ @JimmyShelter thanks, I extended the answer to be more informative. \$\endgroup\$ – concept3d Nov 25 '13 at 1:46
  • 1
    \$\begingroup\$ The downvoter should at least explain the downvote, otherwise it's not really constructive criticism.. or provide a better answer. \$\endgroup\$ – concept3d Nov 25 '13 at 15:00
  • 1
    \$\begingroup\$ A further point for performance is that the hardware might not even support quads. The driver might be doing an expensive per-draw pass to change any quad list into a triangle list. D3D doesn't even support quads anymore. \$\endgroup\$ – Sean Middleditch Nov 25 '13 at 18:10
  • \$\begingroup\$ I understand now because in my custom mesh file I have everything in triangles and it runs just fine. When I looked at tessellation with CONTROLPOINTS_4_PATCHLIST I was thinking to myself - wouldn't tessellating more control points be more helpful in smoothing out rough areas of the mesh. Wouldn't I still be able to render a tessellation CONTROLPOINTS 4 PATCHLIST even if I have the mesh in triangles? I know I would have to change the domainshader from TRI to QUAD. \$\endgroup\$ – SICGames2013 Nov 26 '13 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.