Search Unity

What is a quad?

Discussion in 'Getting Started' started by evan_ohara, Jan 30, 2018.

  1. evan_ohara

    evan_ohara

    Joined:
    Oct 28, 2016
    Posts:
    35
    This question seems dumb and simple.. I've looked at all sorts of definitions and the one bit of info I can't seem to totally clarify is if the 4 vertices must be coplanar. In 3ds max I've noticed sometimes it looks like I have 4 connected vertices but from another angle they don't appear to be coplanar. Ty.
     
  2. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    I'm not expert, but I believe non-planar geometry usually won't shade correctly and is considered a no-no. I know that from experience usually if you get a non-planar quad (appears bent and one side will be dark while the other is lit) it is because you did something strange and out of the ordinary.
     
  3. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    But a better place to ask this would be the autodesk AREA forums for that specific program.
     
  4. evan_ohara

    evan_ohara

    Joined:
    Oct 28, 2016
    Posts:
    35
    Yea, I wasn't really sure if this was the best place to ask, but without knowing everyone's background I thought I would trust Unity users more as it applies to games. That's kind of what I figured though. Thanks!
     
  5. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    A quad is not required to be coplanar. It boils down to polygons. You're deforming vertices, which shape triangles, which are polygons. A quad is just a shape, like an octagon.
     
  6. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    https://knowledge.autodesk.com/supp...erview-Planar-and-nonplanar-polygons-htm.html




    This is good. A second opinion, and most likely more experienced than me, so I decided to look this up for myself.

    Perhaps @LaneFox might elaborate?

    I can imagine some non-planar geometry not being an issue if it is hidden away somewhere, and perhaps it may not present a shading issue depending on where it is on your model. But it there any benefit to having non-planar geometry? And practical use for it?

    Like the OP, what I've found written about the subject just basically reiterates what I've learned, which is that it's not game breaking or anything but could lead to problems, so go ahead and avoid them and clean up when you're done modeling.
     
    Last edited: Jan 31, 2018
  7. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    I'm not really sure what you're asking here, or what needs elaborating.

    The model will break down to the smallest buildable polygon (three sides, a tri) and anything bigger than that is considered an n-gon, a polygon with "n" sides, such as an octagon. All ngons are still just groups of triangles. A quad is two triangles and is generally considered the standard major path shape because it's easier to model with over triangles, but the engine is still going to look at triangles. A quad is not required to be coplanar.
     
    Last edited: Jan 31, 2018
    Kiwasi likes this.
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This. A quad doesn't really exist at the engine level. The engine only knows how to draw triangles.

    There is a Unity primitive called a quad. Which is basically a rectangle made up of two coplanar triangles.

    It's less common, but equally valid, to call any four cornered polygon a quad.

    Modelling software also uses quads for convenience. But these always get converted into triangles for rendering or use in a game engine.
     
    LaneFox likes this.
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Quads do exist at engine level; MeshTopology.Quads. On a lower level, OpenGL used to have quads but they were deprecated, and in any case the GPU only draws triangles.

    --Eric
     
    LaneFox and Kiwasi like this.
  10. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Huh. I learn something every day.
     
  11. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Yes, my point is it's still just sugar. Modelling is generally done with quads because it's easier to manage loops and generally work with the intermediate edge not shown so we do see something on the front end that could be confusing but it's still two tri's at the bottom line.
     
    evan_ohara likes this.
  12. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    The OP question wasn't exactly the same as the thread title. He wanted clarification about the practical consequence of non-planar quads.

    So, from what has been said here so far, is it correct to say that, because all quads are digested into triangles by the game engine, a non-planar quad would be broken into two triangles with a sharp difference in the angle of their faces that might cause unwanted shading issues -- leading back to the general advice from Maya documentation and hence the method for eliminating non-planar geometry in the mesh>cleanup function?
     
  13. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Yes, but it depends on the smoothing groups and how the applied shader behaves.
     
  14. evan_ohara

    evan_ohara

    Joined:
    Oct 28, 2016
    Posts:
    35
    Ok, awesome ty! I think this digs more into why I was asking what a quad was. It was just as important to know why it's important to model using them.

    I am currently working on a walkthru for some equipment. I am creating the models in revit and importing to 3ds max. They don't import as quads, converting from editable mesh to editable poly tends to collapse a lot of verts in some of the geometry (particularly any parts created using a sweep). My initial thought for wondering this was whats the harm of just shoving the revit drawings made of tris into unity. (Other than the obscene amount of tris and verts.)

    Anyway, so just to confirm... there's no difference between a model made of tris verts and ngons in unity and the reason to model them in quads is because it's easier to select loops for modification? The red flags at the beginning of all modelling tutorials is simply to get you to start with good modelling habits?
     
  15. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    When an n-gon is divided into triangles, it's anybodies guess how exactly it will be divided, whereas with a quad it can only be split two ways.

    So if your n-gon is not on a planar, static surface, when it is divided, it could end up looking weird as you could have poin edges where you don't want/expect them to be, or a sharp edge where there should be a smooth deformation, or shadows not reading in a logical manner, etc.

    Again, this is the extent of my noobish understanding, not a comprehensive answer. I remember reading a bit about this on the polycount wiki, so that is one place to go for more comprehensive reading. I do know that avoiding n-gon's isn't purely for the artist ease of work -- in common game asset workflows, they can cause problems and thus there is mesh cleanup functions in your 3d applications for finding and eliminating n-gons, lamina faces, non planar quads, etc.

    But I did ask a similar question to this once at the autodesk Maya forums, and I think the official answer was that non-traditional geometry is fine for static, non-deforming geometry.