Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Modeling - Are Triangles bad?

Discussion in 'Formats & External Tools' started by iNoMore, Sep 23, 2014.

  1. iNoMore

    iNoMore

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi everyone,
    I am sure it was asked somewhere, but I can seem to find any real solid answer for this

    I am now starting to learn a little bit of modeling (programming background)
    and there is something that confuses me...

    Everywhere I see "Keep your model clean with quads"
    and "Never have N-Gons on your model"
    But eventually, every game engine (that I can see) convert your model to Triangles...

    So are Triangles really bad? and what about N-Gons? and if so, why? and if not, why everybody says it does?

    Thanks!
     
  2. saftschachtel

    saftschachtel

    Joined:
    Sep 23, 2014
    Posts:
    3
    Hi,

    as you mentioned, most graphic engines convert 3D-models into a triangle surface. Triangles form simple closed areas in 2D and are the easiest way, to describe a closed area in a plane. Triangles have some properties that are used for calculation and rendering the images. For example triangles form always a convex area, the order of the vertices define the direction of the normal and so on. These properties are very important for implementing fast rendering processes on graphics hardware. But these infos are only important for the rendering process, that means for the calculation of the image.

    I am not so experienced in modeling, but I think if you model your object with quads, you get smoother surfaces, that look good. For rendering an object each quad is converted into two triangles, as mentioned above. This conversion is relatively easy (you only have two possibilities) and the resulting triangles won't be degenerated in the most cases. If you model objects with triangles it is relatively easy, to produce surfaces with degenerated triangles, that look "ugly" during rendering. Especially triangles that have one short and two very long edges can cause problems. If you use N-gons these problems even get bigger. For example there are five possibilities to split a pentagon into a set of triangles and you can't really tell automatically, which one of them will look the best. For higher ordered N-gons the possibilities to split the area into triangles grow very fast. E.g. for hexagons I can distinguish between 90 different possibilities to split the area into triangles and here you also don't now which produces the best looking result.

    That's what I know and think. Let's see what the others say.
     
    Semperfoo and lennyzhou like this.
  3. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,480
    This has nothing to do with being evil. It's all about the workflow :)

    First , to work in quads in your modeler has nothing to do with the game engine. Game engines is for the final result. They usually work with Tris. But your modeler is for making the graphics. And here you can also use Quads and Ngons when required.

    A quad topology is much better to judge and to work at. Just half as much edges in the way. And you see how the loops are going. Your modeling software also relies at a quad topology for quite a few tools. Like everything that works with loops. A cut loop will not work as expected at a tri topology. The tris will lead the loop in wrong directions. Or stuff like Subdivision Surface. Tris will not work well here neither. It will produce so called poles. Same goes for rigging and animation. Here you are again much better suited with quads. Because they keep the topology and edge- and faceloops intact.

    When done and when export it to the game engine it is better to triangulate the mesh before we do so. Because at import the game engine may triangulate quads or Ngons of the mesh in another way than our modeler. Which can lead to unexpected results. Wrong deformations, or convex faces where it was concave before.
     
    Last edited: Sep 23, 2014
    LaKais, mysticvalleycsa and lennyzhou like this.
  4. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    637
    You want to use quads in general because it keeps your model cleaner, and you get better subdivides out of it That doesn't mean that all triangles are bad. A mostly quad model with a few triangles in it isn't going to hurt. Some people in the game art community stress out about that stuff, which is probably where you heard that triangles are bad.
     
    Kaivaan likes this.
  5. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,038
    If you're going to make 3D models for Games, Always, in most cases, make your models in Quads. It is much easier to model in Quads, and it makes it easier to look at, find and detect problems in the mesh as well. Then when you put your model in the game engine the game engine converts your pretty object into Triangles nicely. :D

    A trick used in gaming: Triangles in gaming, are used in meshes full of Quads, to animate moving parts of clothing/folds in clothing etc.

    Triangles are also used, if parts of the Armour for eg. A Knight has a circular disc ornament on his armour. They will use a circle made up of Triangles for the circular ornament. This also helps to keep the 3D models low poly.

    Why you ask?
    Many Quads make up the most important parts of the object. But the "useless," or less important parts of the 3D model may use less quads, or the 3D modeller will use triangles to cut down on the poly count.

    A good example I could find is this one........Note, that this is not my work.
    http://www.zbrushcentral.com/showthread.php?77667-My-work-from-Assassin-s-creed-2-)

    Notice the pic of the guard with the blue plumes on his helmet, holding the halbred weapon. Notice the disc shaped circular ornament on the right side of his chest. This is a good example. They could have used quads to fill up the circular ornament, but they used triangles instead.

    Sometimes it's the 3D modellers preference, to use triangle instead of quads, for certain parts of his 3d models.

    Also on the same Guard, notice the Triangle under his weapon holding arm. And the one on his boots too.

    Also, on the model of the guy, wearing the yellowish hoody thingy and the rusty reddish tights pants, with his hand on his belt. (He's standing next to the messenger guy with the scrolls and the red old time hat.) Notice the triangles on the folds of his clothes below his belt.

    Hope that helps. Bye.

    PS: Also remember when modelling in quads, you have to model the character, in such a way so that animation would look great. Other wise if the character looks nice, but you model it wrong, parts of the character.....eg. parts that bend like the knee area etc.
    Will distort, or look black in certain areas, of the mesh when you play your animation.
    Sometimes like in the Assassins Creed pics, they use a combination of Quads and Triangles, to help with game animation and keep polycount low too. This helps the game engine too.

    Oh yes, I read somewhere that they sometimes, use Ngons, for certain parts of 3d Human game characters backs. Ngons are sometimes used, for near useless secondary or third level objects as well. I saw a pic on it too, but I can't find it. Lol! :p


    I use this type of modelling technique when making 3D models of characters too. I would show an example, but my PC has been down for a while. Lol! :p
     
    Last edited: Jan 31, 2021
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Gpus only understand the concept of triangles. I'm not sure what all this gibberish is. I can only assume people are talking about 'smoothing groups' or vertex normals.
     
    Dipak_UMX likes this.
  7. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    637
    No, people are talking about using quads and n-gons in modeling software to make the modeling process easier. Yes, the game engine only cares about triangles, but as it turns out, polygon modeling with only triangles is a pain in the ass. Think of it as a higher level wrapper around your basic triangular mesh.
    But all it really is is a different way to store data. If you're interested in the technical aspects, look up "Winged Edge Data Structure".
     
  8. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Nobody models with triangles. It's triangulated regardless by the time it gets to Unity. The gibberish I refer to is from people advocating modelling with triangles.
     
    Dipak_UMX likes this.
  9. Rinoa_Heartilly

    Rinoa_Heartilly

    Joined:
    Jun 26, 2014
    Posts:
    85
    Triangles have their role, for example, geosphere (made by tris) consumes less tris than quad sphere, several years ago when low-poly rules the world, we used to cut quads into triangles in some places to get the most use of polygons. Triangles are not bad, they're just inconvenient, when you extrude (shift drag) an edge you'll have a quad, and when I make models I'll do that alot, and did you try turbo-smooth a mesh full of triangles? :p
     
    JamesArndt likes this.
  10. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    408
    I'first started modeling in 3D Studio under DOS... more than 15 years ago. Triangles are not bad... Try modeling with quads to keep edgeflows clean, but dont be afraid to optimise or collapse quads, or complete some portions with tris. In games it doesnt matter, as far as your edges are clean. Triangulate ngons.
     
    JamesArndt likes this.
  11. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    For modelling something high poly that you're going to want to subdivide, it's best to avoid triangles. For low poly game engine artwork, they can be useful for reducing the poly count. Just use them carefully.
     
    BrandyStarbrite likes this.
  12. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    312
    it also completely depends if you're modeling organic or hard surface/environment props. For animation purposes, its much better to keep as many quads as possible, laid out in nice edge loops and rings. For environments and a lot of hard surfaces, where everything is static, you can get shapes much quicker with well placed triangles at a much lower polycount.
     
    BrandyStarbrite likes this.
  13. eelstork

    eelstork

    Joined:
    Jun 15, 2014
    Posts:
    219
    Neither n-gons or triangles or quads are bad. It's case based:

    - The advice about sticking to quads comes from the fact that they are easier on the eyes (most of the time) while modelling, and most off-the-shelf subdivision algorithms (not all!) handle quads better.

    - The reason GPUs render triangles and not quads is that quads aren't always flat. In fact most quads output by a modelling tool are not 100% flat which doesn't easily rasterises. This takes you into a problem that can get a lot worse with n-gons: for a single quad, there are 2 ways to break it down into triangles. With very low poly geometry, this can look bad. So, if you see a quad that's not flat and the output looks weird, you might want to split this one manually rather than relying on the automation.

    - n-gons can help make a model more readable. The top of a cylinder is flat. So, a flat n-gon with N vertices is really a neat way to present geometry to the user. Just keep in mind that not all modelling software will bother flagging non flat ngons, and that the triangulation carried out internally can interact very badly with some algorithms, including subdivision but even shading algorithms.

    If there wasn't significant demand for ngons (and good handling thereof, which can only be expected to improve over time) I doubt very much that people making modelling software would bother with them.

    In conclusion...

    If learning organic modelling try to learn the quad oriented workflow although hopefully you'll eventually mature to the point that you can tolerate a triangle or pentagon here and there : ))
    If dealing with "hard, flat surfaces" ngons are fine.
    Triangles are as WYSIWYG as digital geometry can get, but it's like machine code, people hardly bother with these anymore.
     
  14. mysticvalleycsa

    mysticvalleycsa

    Joined:
    Sep 22, 2020
    Posts:
    14
    A point neglected here by all except a meandering commentary on a collection of images, is that modeling with quads is useful during the animation phase: they transform and turn better than inflexible triangles. The same effect requires many more triangles, accounting for many possible rotations, which is difficult in, say, ball joints. This is then passed to pre-render algorithm to divide into a complex of triangles for collision and shading.
     
    Last edited: Jan 13, 2021
  15. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    512
    That may be true for modeling and animation programs. Blender, from my experience, re-triangulates quads and n-gons dynamically depending on situation. But does Unity do that? Ithought that in game engines, meshes have pre-determined triangle face definitions.
     
  16. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    254
    I've heard a lot of people say something like this about tris, but I've yet to see it. Do you have an example where a quad 'turns better' than tris? From what I can see, they deform exactly the same
    upload_2021-1-13_9-51-54.png
     
    LaKais likes this.
  17. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    512
    Yes, if triangulation is static in Unity, then there isnt any advantage in deformation between quads vs. triangles
     
  18. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,480
    I think you have misunderstood something. Blender does not automatically change your geometry. It was however in earlier versions of Blender not possible to model with N-gons. N-gons were triangulated away immediately. The mesh engine was just able to deal with tris and quads. But since BMesh was invented back in Blender 2.6x days this is not longer the case. Now you can also model with N-gons.

    It does. It's just not obvious here. The quads bends different, dependant of how the edge to divide the quads into two tris is oriented.

    In general, the edge to divide a quad into two tris can have two possible directions. It can go from down left to up right, or from up left to down right. And it is not guaranteed that Unity imports the order of the tris in the same way that you export it from Blender. And then this can lead to unwanted deformations. You usually run into such trouble in arm pits, or between the legs, in the hip region.
     
  19. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    254
    Quads will bend one way or the other. The only way to make sure they bend 'correctly' in both engines is to triangulate them before export. This isn't really an argument for why quads 'bend better'.

    Also using quads in blender will give you a false representation of how it will look in Unity, as the internal triangulation of the quad will change depending on the current pose. This does not happen in Unity.
     
  20. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,395
    In my tests, Unity triangulates consistently on import – if you need to assemble blend shapes in Unity by importing separate obj Unity will need to triangulate all the meshes the same way.

    A weird thing on import, there's a checkbox for Preserve Quads… This didn't import as I expected. On a mixed-tri/quad mesh, Unity splits into 2 meshes (!). I guess it's intended for quad-only meshes.

    I think the only place I disliked triangulation is with a cloth deformer..., you'll either want nice uniform quads or completely random small triangles to break-up the visible edge folding.
     
  21. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    512
    Do no paint me as clueless please. Blender (latest version BTW) definitely changes poly triangulation dynamically, it is evident when, for example, a quad is twisted to certain angle

    My point (as response to @mysticvalleycsa) was, if Unity engine does not have this feature, then there is no way that quads "transform better" than triangles. If the line bisecting the quad stays the same during all possible deformations then there is no difference between having the quad or 2 triangles. I agree that it is better to manually triangulate n-gons (and in some cases, quads) before export, since exporter doesnt always resolve them in optimal manner.
     
    Last edited: Jan 14, 2021
    Tiles, jRocket and Siccity like this.
  22. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    637
    Also worth mentioning- if you are baking normal maps, you should triangulate beforehand because if the triangulation is different between the model when baked and the game engine, you will have an incorrect normal map. I am surprised that there hasn't been an effort to standardize a triangulation method like there has tangent basis.
     
    JamesArndt likes this.
  23. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,882
    Any 3D application has you modeling with triangles under the hood. In most modern 3D applications the fact you are working with triangles is "hidden" from you and you view geometry as quads. It's easier for 3D artists to work with and wrap their heads around quads and thus why you see this discussed so much. Now depending on how you manually split those quads into triangles can sometimes cause funky deformations for bound meshes and can cause shading errors or anomalies when imported into a real-time rendering engine. It's best to triangulate geometry at export before coming into Unity so you have complete control over the winding direction of which vertices end up connected by an edge. I'm sure most of you have come across this when seeing a weird shading issue on an imported model in Unity. You will find you did not expect to see an edge subdividing across a quad face in the direction that it is. This is because as you worked in quads you did not see the hidden triangulation of that quad and now you have a surprise come render time!
     
    Tiles and mysticvalleycsa like this.
  24. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,480
    It was not my intention to label you clueless. I just thought you might have misunderstood something since i remember the pre bmesh times :)

    I get your point. We are both right here. The geometry does not change. The quad is still a quad. It's the underlying triangulation that changes. The graphics card has to draw the quad somehow. James Arndt has explained it pretty good i would say.
     
    JamesArndt likes this.