Home Technical Talk

Why is triangle used instead of Quad?

garrettia
node

Why is triangle used instead of Quad? Why is triangle used instead of quad in the first screenshot as in the 2nd screenshot? I thought diamond shaped quads could be used?

Replies

  • Neox
    Offline / Send Message
    Neox high dynamic range

    First of all, in engine everything is triangulated.

    But also because it's safe. If you use that quad, chances are the triangulation will flipped on export to the engine. You really do not want that one flipped there.

  • poopipe
    Online / Send Message
    poopipe godlike master sticky

    We use triangles because triangles must be planar.

    This factors hugely into calculations about depth/sort order etc.


    A quad can be non planar which makes things a lot less certain

  • garrettia

    Are there any resources you can recommend for this?

  • gnoop
    Offline / Send Message
    gnoop polycounter

    A game engine would turn it into triangles anyway. At least ours do. It's just in a place like that it could be a very thin triangle so better be set manually first. Thin triangles are considered not good for game renderers.

    People often say triangulation is important for accurate normal map baking . It's not true actually. Only vertex normals are important.

    Imo it's perfectly fine to have quads too in many areas . Easier to cope with.

  • Tiles
    Offline / Send Message
    Tiles greentooth

    Don't forget to distinguish between modeling and the final result. Lots of modeling tools requires a quad topology. Edgeloops may fail at a tri topology. So model in quads, and for game needs check for correct triangulation in your engine. Which can mean to triangulate the geometry before you export. This was best practice for quite a while, before the game engines learned to deal with quads too.

  • Neox
    Offline / Send Message
    Neox high dynamic range

    Which engine actually does use quads as the final rendering geometry?

  • Tiles
    Offline / Send Message
    Tiles greentooth

    Unreal not sure, but Unity can import and render quads.

    When we talk about final rendering though, even modeler like Blender or Maya or Max uses a triangulated geometry under the hood. It's the most stable geometry.

  • Noors
    Offline / Send Message
    Noors greentooth

    Everything use triangles under the hood, that's the only geometry the GPU understands. Rasterization deals with groups of 3 verts. There is no notion of edge in mesh data.

    Indeed Unity can interpret quads (even ngons ?), like Blender or Maya. Though i'm not sure what the point is. (edit: for tesselation !) But still it's all triangles for the GPU. It's also true that quads are easier to handle for artists when they need to quickly select loops or needed for subD for instance.

    The issue when you don't triangulate, is that softwares in your pipeline don't always triangulate ngons the same way. And that's a pain in the ass.

    "People often say triangulation is important for accurate normal map baking . It's not true actually. Only vertex normals are important."

    Not true, the triangulation dictates how surface normals are interpolated between vertex normals.

    The normals are calculated for every pixel, with a barycentric interpolation of the 3 verts normal of each triangle (aka Phong shading)

  • Tiles
    Offline / Send Message
    Tiles greentooth

    Thanks Frank. Great examples how topology influences shading and normal mapping :)

    Indeed Unity can interpret quads (even ngons ?), like Blender or Maya. Though i'm not sure what the point is.

    The point is that most of the times you can simply export the quad mesh that you have modeled, and get away with it. It might even work with a dynamic mesh. Nowadays some game characters are made of 20k plus tris. You might not even notice a wrong bending quad here. That's a workflow issue. It saves time and energy. And time is money :)

    That under the hood at gpu level everything works with triangles is another issue then. And my comment was aimed towards the statement that game engines just understands tris. Which is not longer valid. Some still does, some not.

  • matsbtegner

    This does not apply to offline render engines such as Pixar's RenderMan:

    Primitives are tessellated into micropolygons.

    https://rmanwiki.pixar.com/display/REN24/Geometry

  • gnoop
    Offline / Send Message
    gnoop polycounter

    Based on our game I have never seen a single issue from quads only exported with split edges where they typically should be . But my quads are usually planar and the export is from Max only . Pretty much same as in this gif https://us.v-cdn.net/5021068/uploads/L1SEPP7O9J38/example-bakingtriangulation-animation.gif posted above. So I stopped to care long ago. Well, still putting triangulate modifer in Blender just in case. Never seen issues either although.

Sign In or Register to comment.