Home Technical Talk

Mesh Topology

Hello,
Simple question : why subdivide a quad into 2 tris? Example :
sol%20temple.jpg
Last images showing wireframes
I do not own this image, it was taken from this thread which I recommend taking a look at : http://www.polycount.com/forum/showthread.php?p=1321690#post1321690

Thanks!

Replies

  • cryrid
    Options
    Offline / Send Message
    cryrid interpolator
    Because every quad is made out of two tris.
  • Benton
    Options
    Offline / Send Message
    Games need models to be triangulated. Normally it gets done for you via the game engine importer, but I think it is a good idea to do it in your editor so you don't get any nasty surprises.
  • pongo1967
    Options
    Offline / Send Message
    ''Because every quad is made out of two tris.''

    But isnt it 2 polygons rather than 1?

    and arent you supposed to keep the Polycount low? see what I did there?
  • m4dcow
    Options
    Offline / Send Message
    m4dcow interpolator
    When one talks about poly limit, it usually means triangles and not quads. Due to the math involved any geometry is converted to triangles anyway, be it quads, n-gons etc... So while technically 2 triangles are 2 polygons, it isn't relevant when talking about 3d geometry and polycount.
  • cryrid
    Options
    Offline / Send Message
    cryrid interpolator
    But isnt it 2 polygons rather than 1?

    Polygon can be a misleading term when you're trying to size up a model. One polygon can have 3 verts, one polygon can have 4 verts, one polygon can have 59371 verts. Splitting a quad into two triangles wouldn't do anything on it's own to change the vertex count, so while it sounds like there are twice as many polygons, the mesh isn't 2x heavier.

    Think of the term more like the word "coin". Triangles are like pennies in this case; it doesn't get any smaller as far as 3d goes. But there are other coins too (nickles, dimes, quarters, etc). If someone says they have 50 coins in their pocket, you don't know how much money they really have with that information. If they say they have 50 pennies, you know.
  • Eric Chadwick
    Options
    Offline / Send Message
    A quad can be triangulated two different ways. Manually editing the internal edge direction helps you make sure the topology is exactly what you want. It also makes sure the normal map will be rendered correctly, because the triangle flow affects the normal map.

    http://wiki.polycount.com/PolygonCount
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    polygon = "many sided". a polygon is a generic term used to describe ANY shape with multiple sides.

    a triangle is a polygon
    a quadrilateral is a polygon
    a pentagon is a polygon
    a hexagon is a polygon

    and so forth.

    game engines render every "polygon" as a face with the lowest number of sides possible. which is a triangle (you can't have a two sided face). so even if your model is made up of quads and hexagons, or decagons... it will ALWAYS be broken down into triangles.

    therefor, counting in triangles is by far and away more accurate than counting in polygons.
  • Eric Chadwick
    Options
    Offline / Send Message
    I think you mean "you can't have a two edged face". Two-sided has a different meaning altogether.
  • Mark Dygert
    Options
    Offline / Send Message
    PolygonsExplained.jpg

    Invisible or hidden edges only really apply to modeling software. Often the direction of the hidden edges is determined by the program, for example Maya forces all hidden edges to flow in a certain direction so if you want to flip a hidden edge you have to force it to be visible. In Max you can flip hidden edges any way you like but there is a strong chance that they will be reinterpreted to flow one direction when imported into something else, FBX export (common UDK export method) complains about flipped edges, so you force them to be visible or triangulate the model before exporting.

    Every mesh is triangulated for games and it will sometimes determine the direction of the hidden edges. Also games count triangles not polygons. If you remove all of the visible edges from a model you haven't saved anything but crated a nightmare because you have no idea how those hidden edges will be read.

    Actually games count verts more than they count triangles. Each vert on a UV seam gets doubled, some shaders, material breaks and smoothing breaks also add to the overall vertex count above what is reported in max/maya. This is one reason why you want as few UV seams and as few materials per mesh as possible.

    Recommended reading about splitting up meshes: http://www.ericchadwick.com/examples/provost/byf2.html
  • throttlekitty
    Options
    Offline / Send Message
    Just wanted to point out that those "hidden" triangle edges are present in max/maya/whathaveyou, but just secretly used behind the scenes.
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    I think you mean "you can't have a two edged face". Two-sided has a different meaning altogether.

    well if we want to be REALLY pedantic, polygon means many corners, not many sides...

    so pffffft!
  • Eric Chadwick
    Options
    Offline / Send Message
    You're welcome!
  • Illusions
    Options
    Offline / Send Message
    Illusions polycounter lvl 18
    Just wanted to point out that those "hidden" triangle edges are present in max/maya/whathaveyou, but just secretly used behind the scenes.

    If you want to see how these hidden edges can affect how your geometry looks, make a single quad flat on the grid, grab two vertices diagonally opposite one another, and move them up or down. You can now watch your quad crease along that hidden edge.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    You should also always triangulate your mesh before baking normal maps etc. If you don't, you can often find that the game engine might triangulate your mesh differently, thus rendering the normal map (somewhat) broken as the topology has changed.

    Also, what Mark said. Verts. > Tris.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Also, with triangulation you are 100% how your shading is on your model.
    Imagine you got four side polygon, all vertexs are in the same z level. Then move on vertex up or down. Now you got two ways the shading can be, depending on which way you cut the polygon. Try it out and you will see. Especially with low low models, its often done to get the correct shading on models without any normal maps.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    In Max, I usually just drop a Quadify Modifier on my model before anything is exported/baked. It's gives very tight and clean results that follow the bends correctly, with minimum cleanup, not sure what Maya or XSI have in that regard.
  • Mark Dygert
    Options
    Offline / Send Message
    Quadify Modifier at 100%, I guess that could work, but you could get yourself in trouble if you let it sub-divide the mesh, which it does at the default settings. Personally I use the "turn to poly" and set the max size to 3, then export and then remove the modifier or turn it off, so I the mesh is still quads and easier to work with.

    This is also important for deformation, like McGreed pointed out, you expect a poly to fold a certain way and if the hidden edge flips and it folds the opposite way, then it could deform undesirably, as well as alter the tanget for the connected verts and make the normal map incorrect like metalliandy pointed out.
  • pongo1967
    Options
    Offline / Send Message
    Thank you all a lot! I learned something.
  • Gannon
    Options
    Offline / Send Message
    Gannon interpolator
    tl;dr

    Everything becomes a triangle at render time.
  • Snader
    Options
    Offline / Send Message
    Snader polycounter lvl 15
    Is this really true, though? I recall something about a very small minority of engines being able to work with planar quads? And I'm positive that the DS benefits of using quads because of vertex counts, but maybe also for other things. It might also be implemented to circumvent skewing issues of affine mapping?

    I mean, as a rule of thumb, yes, everything is triangles, but I was just wondering...
  • Eric Chadwick
    Options
    Offline / Send Message
    The programmers on Star Fleet Command 2 assured us that quads were better than triangles in their engine, for performance reasons. So we delivered ship models using as many quads as possible within the budget limit. But that's the only case I've ever run into that preferred polygons over triangles.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    @snader, Yea, AFAIK, everything becomes triangles in every engine I have heard of.
    Are you sure that this minority of engines don't use the same trick that 3d apps use to render ngons?
    I'm not sure how rendering as quads would alter the vert. counts of of a mesh, but perhaps they do something I am not aware of.

    I would think that the reason that everything renders as triangles, is that its the simplest geometric form that can be rendered on screen (excluding verts.) and is only dividable into other triangles. This makes is much faster then rendering quads/ngons as you are rendering the simplest object that can be rendered over and over, rather than wasting overhead creating other n sided polygons which could be generated faster by creating the same shape out of triangles in the first place.

    *Edit* Eric beat me to it. Ok, so 1 engine like quads :P
  • m4dcow
    Options
    Offline / Send Message
    m4dcow interpolator
    Straight up alot of what our GPU's do is a fuck of alot of trigonometry really quickly (transformation-wise.) The math is there that if we have dimensions or angles of a triangle we can figure out the rest we don't know. The more edges you add, the more complicated it gets to compute, but as we have been talking about, you can split up really large polygons to compute them in terms of triangles.
Sign In or Register to comment.