13
$\begingroup$

I read somewhere that Ngons were nothing more than triangles masked as an Ngon.
Some testing reveals this is not true, at least to some extent.

Here are two sub-surfed cylinders, one with an Ngon, the other with a Triangle Fan.

enter image description here

The things that look like 6 sided Ngons in the Triangle Fan example are really quads, and the cap on top is really a lot of tris:

enter image description here

As you can see, they are definitely different, but what is the difference technically?

$\endgroup$
  • $\begingroup$ in the first example there are still 6 sided ngons, the ones directly adjacent to the cap at the top. $\endgroup$ – zeffii Jul 6 '13 at 21:25
  • $\begingroup$ @zeffii those are quads, I checked in edit mode.. I guess that is some error with object mode wire frame view? $\endgroup$ – gandalf3 Jul 7 '13 at 2:04
13
$\begingroup$

This question is very generic - but you give a very specific example (Subsurf) which happens to treat ngons differently to many triangles (to be clear - differently to a triangulated ngon).

The answer is something like ... it depends: each modifier, tool, export-format and rendering engine can choose to use ngons / quads / triangles - differently. There are no fixed rules here, some tools triangulate internally to perform their calculations, others are able to handle ngon data.

Here are some general rules that mostly apply.

  • Rendering typically converts everything into triangles.
  • For OpenGL display, quads/ngons are also triangulated.
  • Some formats (OBJ, FBX for example) support ngons.
  • For Blender's tools - ngon support varies, but most tools support them.

Note that even in cases where ngons are triangulated, the normals from the ngons/quads are often used. So you may get a better looking model when smoothing is applied on the non-triangulated mesh data.

$\endgroup$
  • $\begingroup$ subsurf actually doesn't treat tri/quad/ngon differently. See my answer. $\endgroup$ – Alistair Buxton Jul 7 '13 at 12:38
  • $\begingroup$ So it seems the answer to my question is, Ngons themselves are really ngons, but some tools/formats/etc. don't support them and they will be triangulated.. $\endgroup$ – gandalf3 Jul 7 '13 at 19:11
  • $\begingroup$ @Alistair Buxton, Think you misunderstood, added some clarification. $\endgroup$ – ideasman42 Jul 7 '13 at 23:03
15
$\begingroup$

Subsurf does not treat tri, quad and ngon differently:

Subdividing a tri, quad, and ngon.

In each case the result follows exactly the same pattern:

  1. Every edge is subdivided into exactly two edges.
  2. Every face is subdivided into n faces where n = original number of vertices. Every new face is a quad.
  3. A new vertex is created at the centre of the face. Every new face shares this vertex.

The difference in topology of the two results you showed can be more easily seen if we use simple subsurf (which does not smooth) and then apply the modifiers and look at the wireframes:

enter image description here

The result from subdividing the triangle fan has the extra edges (selected.) These extra edges are the result of subdividing the radial edges which connect the central vertex to the outside edges.

This does not demonstrate any fundamental difference between tris and ngons, because we can produce the same result using only triangles:

enter image description here

On the left is a triangle fan composed of three triangles. On the right our equivalent "ngon" is simply a normal triangle. The result of subdivision is different and follows the same pattern we saw before with the cylinders. The same results would be seen with a triangle fan composed of four triangles and a quad.

In general it's much better to think of tris and quads as special cases of the ngon than to consider an ngon a "bunch of triangles" like a triangle fan or triangle strip.

$\endgroup$
  • $\begingroup$ So if i understand correctly, sub-surf seems to support Ngons, as it's different from when you sub-surf a triangle fan.. (it's not converting to tris before subdividing) $\endgroup$ – gandalf3 Jul 7 '13 at 19:07
  • 1
    $\begingroup$ Yes, but even if it did convert the ngon to triangles first it would produce a third different result different to either of the results we have already seen. This is because triangulating an ngon will not produce the triangle fan that the cylinder tool does. Triangulating an ngon will not change the number of vertices, but the triangle fan has one more vertex (at the centre) than the equivalent ngon. $\endgroup$ – Alistair Buxton Jul 7 '13 at 20:48
5
$\begingroup$

When you use N-gons you are essentially saying "I don't care how this geometry is arranged -- for now", and you relinquish control of the underlying geometry to Blender's tessellator. If you do an N-gon fill of a profile (edge-loop) you won't be able to control how faces are tessellated under the hood for display or rendering. If you need the N-gon to behave a certain way then you have to edit it manually, e.g., do a face-inset or convert it to triangles/quads manually to control the geometry.

See the example below:
left side N-gon, right side underlying geometry that you don't have to worry about
(until it becomes necessary).

.. or you may never be concerned about the underlying tessellation.
.. or the final output may not be tessellated (in rare cases).

It depends on your use-case.

enter image description here

$\endgroup$
  • $\begingroup$ Your post makes the assumption that all n-gons will eventually be triangulated. While this is often the case its not necessarily true. You may output to a format that supports ngons, or you may perform some modifier that supports handling n-gons - or its even possible to render n-gons, though I'm not sure if there are any popular rendering engines that do this. $\endgroup$ – ideasman42 Jul 7 '13 at 2:26
  • $\begingroup$ How do you propose I make this clearer? $\endgroup$ – zeffii Jul 7 '13 at 5:13
  • $\begingroup$ Added note that final result may not depend on tessellation. $\endgroup$ – ideasman42 Oct 9 '17 at 2:15
2
$\begingroup$

At the end of the day, it's all triangles - however the idea of NGons is an abstraction that helps the software deal with certain situations that come in handy when modelling (such as being able to slice a plane any which way you like, then extrude it)

$\endgroup$
  • $\begingroup$ This isn't always the case, some calculations are done directly on ngons (without triangulations). - booleans for example & some aspects of the knife tool. $\endgroup$ – ideasman42 Nov 11 '14 at 17:42

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.