Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Koko Ricky

Triangles versus quads?

Recommended Posts

Can anyone explain which polygonal rendering method is more efficient and why? I seem to get the impression that triangulation is better structurally, which would make sense because triangles and hexagons are the most stable structures in the universe.

Share this post


Link to post

Cant's say much for which is faster per se. But as for working with them and where they fit. It depends on what you want to do.
Like, if you got tesselation on a model, you basically has to have it with Quads rather than tris because there is no overarching structure with tris. A tris model that is using subdivide or tesselation will not be as cost effective nor give off as good results as a quad model.

Quads also got the benefit of deforming more dynamically when you animate them. A backside however is that a Quad can be deformed differently in different 3d programs. And while that is not a big issue, it can cause side effects that look bad unless you fix them. Specifically that you can get odd texturing deformations. Usually you can fix this by making the quad into two tris (though not recommended if you intend on using any tesselation on the models) or adding more model detail to the issued area.

Also in sculpting the two got benefits and drawbacks depending on which you decide to choose.
For instance. A quad structure lets you move up and down between detail modes without effort. You can even base your low poly model off of a lower layer of detail.
However, whenever you need to add more detail to one area, you have to add detail to the entire mesh. Also, you can't dynamically add detail to one area, so you can't pull out limbs and such from a box models and just sculpt away. You can pull our a bit of course. But since you don't add new information when doing this, you will create tearing in the polies and usually end up with some bad sideeffects. You need to have a basic idea of what you want to do first, and make a rough low poly model to work off.
This is what is used in programs like Mudbox and Zbrush.

While Sculptris for instance uses the tris method. Where the benefit is that you can just sculpt away and not worry about any of that technical stuff like model structure or preplanning your design. Since new polies are added dynamically as you sculpt. So one area can be really detailed while another doesn't have any at all. This also mean, you can add any limbs or vestigial structures you like. However you can't move up and down between detail layers and you ostensibly got to make any low poly model from scratch at the end anyway.

That being said, working with subdivision or tesselation (don't know why there are two words for this, as far as I can tell, it's essentially the same thing) got the benefit of being a lot faster than working with actual polies. So if you have a mesh with 1.6 million polies is completely workable as long as that is done by using subdivision. It becomes almost impossible to even load in many programs when those subdivision layers are frozen down to actual polies.

Share this post


Link to post

Quads are for modeling purposes or easy abstraction in your engine. GPUs only accept triangles for the rasterization process (turning polygons into pixels). You could work around it and force them to render other primitives natively, but it doesn't really make much sense as triangles are the lowest common denominator and the process is damn fast these days.

Share this post


Link to post

The number of sub-pixel polys I deal with on a daily basis is ridiculous and still makes my last-gen developer's sense tingle. It'll take another year or two for current game development to sort that pipeline out elegantly as I see it. There's only so far agressive lodding can get you - say, rendering a scaffolding piece in the background. It's really no extra work on GPUs these days to handle two triangles instead of a quad, but what it is though is two extra indicies in an index buffer per triangle pair compared to if it was all quads. 8 bytes doesn't sound like much, right? Now consider a high-quality character model with 10,000+ triangles. Little things add up, especially since data bandwidth is the single biggest issue for modern games.

Protip: The standard for film is to use quads. At this point, it's really only because of legacy ideas that vidya games are still using triangles.

Share this post


Link to post

8K is like magic science magic to me. I don't even know what it is and won't care until I can not possibly buy a monitor with it as a feature without specifically looking for the type without it, you know?

Share this post


Link to post

But by that same logic, eventually someone will argue that e.g. pentagons make for better spherical coverage elements, and so research will be oriented towards making pentagons supported natively (think about how many triangles you'd need to approximate a pentagon...let alone how many quads). Then, it'd be argued that e.g. heptagons or unfolded dodecahedrons make even better elements and so on.

OK, the latter two are BS, but the pentagon does seem to make some sense...it really must be a better choice for covering curved surfaces than either triangles or quads.

Share this post


Link to post

In nature, triangulation is the most efficient shape. I would assume the same would hold true in a simulation.

Share this post


Link to post
Maes said:

But by that same logic, eventually someone will argue that e.g. pentagons make for better spherical coverage elements,

OK, the latter two are BS, but the pentagon does seem to make some sense...it really must be a better choice for covering curved surfaces than either triangles or quads.

Not sure if trolling. But I can only see it being useful for making spheres and basically nothing else.

Share this post


Link to post

Any quad in computer graphics can be made to look like a triangle by using one of the points as a duplicate. A pentagon can be rendered with 8 points with quads versus 9 with triangles. Hexagon with 8, versus 12 with triangles. Septagon with 12, versus 15 with triangles. Etc.

Quads are pretty much a sweet spot. Triangles were really only useful for low-poly work, but that's increasingly a thing of the past.

Share this post


Link to post

At this point I wonder if even hardware engines (or APIs) that accept quads as rendering primitives, actually process them as such and don't further break them down into triangles at the lowest hardware level.

That would mean that the advantage of requiring to push around less raw data to describe a quad compared to two triangles would eventually be offset by encountering a classical space-speed tradeoff at some point down the rendering pipeline.

A primitive pentagon -not necessarily a regular one- would represent an even greater saving in coords -there are several ways to represent a pentagon with triangles, and the very least you need 3 triangles for one pentagon, so 9 vertexes vs 5).

If a hardware engine allowed for drawing "degenerate" pentagons too (e.g. with one or two identical vertexes, degenerating into quads or triangles accordingly) then rendering of certain kinds of surfaces could really be optimized, at the cost of increased hardware complexity. Using even more complex primitives (with >5 vertexes and allowing for seamless degeneration) would probably not be worth it, but something tells me that pentagons would be a sort of "sweet spot".

Share this post


Link to post

There's an old fixed-function rendering style called "fan" which treats the first point of a primitive as a common point between all triangles. If you want to talk about the most efficient way of rendering a pentagon or any other convex two-dimensional primitive, then that's the way you'd do it.

Of course, this is all irrelevant. Modern hardware gets a vertex buffer, and a vertex program is run on each vertex once. Triangles/other primitives only come in to the pipeline when it's time to pass the already-transformed vertices to a geometry/hull program if one exists, and then further for culling tests - in both cases, assuming you use an index buffer, they're just array lookups. Index buffers have long been considered the most flexible and space-efficient way of doing general polygon meshes on hardware.

Interpolation along a primitive for fragment programs is effectively the same cost for a quad as it is a triangle.

Any more than a 4-sided primitive is heading in to special-case usage. There's no real benefit but a bunch of added complexity for using more than quads in the vast majority of use cases.

EDIT: Quads are very definitely attractive when you're dealing with sub-pixel polygons. Solely because of the space saving I previously mentioned with indices.

Share this post


Link to post

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
×