15
$\begingroup$

In film school, in the classes of 3D modeling, I was told that when we model something for films we maintain topology of 4 edged polygons. Any polygon which has more or less than 4 edge/vertex is considered bad and should be avoided. Whereas if the same model is used in games, it is triangulated.

Although I'm not majoring in 3D modeling, the question is still in my mind. Why is 3 edged polygon used in gaming? Does it render faster? Then why not is it used in film renderings?

$\endgroup$
  • $\begingroup$ A triangle is simpler math wise. All 3 points are coplanar so all the points inside the are in the same plane which makes interpolation simpler. For quads I wouldn't know why to prefer that, unless it's to do with LoD. $\endgroup$ – ratchet freak Aug 4 '17 at 22:12
  • $\begingroup$ @ratchetfreak if you begin form a parametric curve and then extend it into a planar definition you end up with something that has a four sided topology, Now as time has gone forward the same problem is still there. $\endgroup$ – joojaa Aug 6 '17 at 14:00
16
$\begingroup$

For 3D modeling, the usual reason to prefer quads is that subdivision surface algorithms work better with them—if your mesh is getting subdivided, triangles can cause problems in the curvature of the resulting surface. For an example, take a look at these two boxes:

original boxes

The left one is all quads; the right one has the same overall shape, but one corner is made of triangles instead of quads.

Now see what happens when the boxes get subdivided:

subdivided boxes, wireframe

Different, yeah? Note the way the edge loops have changed from being roughly equidistant on the left box to a more complicated, pinched-and-stretched arrangement on the right. Now let’s turn off the wireframe and see how it’s getting lit.

subdivided boxes, smooth

See the weird pinching in the highlight on the right box? That’s caused by the messy subdivision. This particular one is a pretty benign case, but you can get way more messed-up-looking results with more complex meshes with higher subdivision levels (like the ones you’d usually use in film).


All of this still applies when making game assets, if you’re planning to subdivide them, but the key difference is that the subdivision happens ahead of time—while you’re still in quad-land—and then the final subdivided result gets turned into triangles because that’s what the graphics hardware speaks (because, as mentioned in the comments above, it makes the math easier).

| improve this answer | |
$\endgroup$
7
$\begingroup$

As @Noah Witherspoon correctly, says triangle subdivision does not work as well as quad subdivision. Although, in the beginning triangles could not be subdivided at all. However, he does not really explain why that is the case. Which is useful information and explains why quads are preferred and how to use them.

First, observe that a triangle does gets subdivided into 3 quads in many schemes. Since you now have a all quad mesh, clearly keeping the subdivision all quad is not in itself the requirement. There has to be a more profound reason than just being four sided.

enter image description here

Image 1: You can subdivide a triangle into 3 quadrangles

The reason lies in what has become called edge loops. The person doing the modeling have to anticipate how the subdivision happens as the subdivision is going to be the final shape. Unfortunately humans are only really good at deciphering the shape of the object along the edges of your primitives edges. By formulating the shape into continuous multi edge long loops helps us predict the shape after subdivision and importantly after deformation by bones etc.

A triangle has a nasty way of terminating the loop so we do not understand what happens with the shape within and out of that shape. The subdivided mesh thus has a tendency to behave uncontrollably, causing undesired bumps. Note: It is possible to subdivide triangles in a way that this does not happen, they are just harder to work with and working with quads were well known by then.

Now this is not actually the original reason, only it happened in roundabout way. The original reason what that the geometrical patches that they did use a as parametric primitives are square in shape. As extending a line into a surface naturally takes a square shape if you just extrude out. Having a triangle causes one edge to be degenerate and have a singularity. But this is very much related to the subdividing reason as it can be shown that a subdivision surface is just a general case of a spline patch.

enter image description here

Image 2: Original parametric surfaces were extensions of curves, not arbitrary meshes and these shapes naturally tend to be square.

| improve this answer | |
$\endgroup$
1
$\begingroup$

One thing i see most people forget is in film making it's mostly about quality not speed. That's cause film making is concerned more with Offline rendering where as in Video games it's all real time so performance/speed is much more crucial than quality.

Hence when it comes to video games people try to find the best way to "approximate" or "fake" the look of a real thing. When it comes to different calculations and speed triangles are much more easier than polygons. Like @ratchet freak mentioned as all the 3 points are coplanar and it simplifies intersections and other calculations. That's one of the main reasons triangles are used in video-games.

However in film making rendering one frame can take hours or even days, hence speed isn't that much of an issue. What Noah said is correct, i just wanted to share this point of view as well.

| improve this answer | |
$\endgroup$
0
$\begingroup$

Even film/animation speeds are something that 3D content creation teams and studios try to increase. Of course they don't mind adding minutes per frame if the output is much nicer, whereas games can add so much to graphics processing before FPS rates drop below an acceptable level, which I think coinsides with the point you are making.

This difference isn't the reason that film/animation works in quads though. Quads are easier to work with when creating rounded and organic shapes. In the end though, it is in fact triangulated, at rendertime. The renderer just creates a new line, per quad, from opposite corners to cut the quad into 2 triangles. This doesn't happen to your model, but do the data streamed to the renderer. The reason is that if your quad's 4 points are not coplanar, and on a larger percentage of your quads in many models, they won't be, you will have nonmanifold geometry. The calculation of the area is basically undefined. If you slice the quad into two tris, that solves the issue as any 3 points are always coplanar.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Well it does not have to be triangulated. Most notoriously renderman didnt turn quads into triangles back in late 1990' and early 2000's. gaining a nice 2 times speed boost. But they do now since they are a raytracing which they didn't back then. $\endgroup$ – joojaa May 16 at 11:03
  • $\begingroup$ Can you provide documentation that they didn't use triangles? AS far as I know you have to triangulate any non-coplanar quad. Even if one point of a coplanar quad is moved perpendicular to the plane the surface has bent, creating 2 planes. You must then calculate each plane, which are made from 3 of the quads 4 pionts (So if point B is moved on quad ABCD, this creates triangles ABC and CDA, with line AC being the hypotenuse). So, you end up with 1 noncoplanar quad calculation turning into 2 triangle calculations. Yet maybe Pixar had a different method than linear equations to the sides? $\endgroup$ – AggieVizzer2015 May 16 at 19:57
  • $\begingroup$ Also, by having to triangulate, I don't mean triangulating your model mesh manually, but that Renderman does this in the background. Even modern game engines do this in the background, hence the reason you can import a mesh with quads into Unreal Engine. $\endgroup$ – AggieVizzer2015 May 16 at 20:03
  • $\begingroup$ I think they dont calculate the intersection the way you think. They microdice so they only sample the vertex of the screen oriented microdiced surface. The underlying surface is a nurbs or catmul rom spline that is guaranteed to have a intersection in another way. For that primitive it does not matter if the face is flat or not since its curved anyway but it dont matter for the screen. Only reason its a quad is to get the derivates of the surface and screen space interpolation. Point being, i would be very careful when saying tgis is the way it has to work. $\endgroup$ – joojaa May 16 at 20:15
  • $\begingroup$ It may be interesting to note that originally the computer graphics guys tried to do analytical solves. They didnt start with the premise of having simplest possible discrete shape. But were looking for higher order stuff. Its only later that we start to do this because we want dedicated silicon for it. Software renderers dont need to follow such rules. Neither do modern harware but we usually do so because we understand that workflow well today. If you can find old renderman manuals its clearly stated there $\endgroup$ – joojaa May 16 at 20:23
0
$\begingroup$

My point was for calculating a flat plane, that is formed by 4 points and linear equations for the sides. If you move one point off the plane, forming a noncoplanar surface, you now have two planes, not one, and thus the only way to still calculate the original surface is to do it for the 2 triangular planes of the original rectangular plane. Now maybe this is only in Maya, but I think its math and thus universal. The micropolygons that Renderman creates very well might use a method that can work with noncoplanar surfaces. I don't know that much about Renderman. I've been told that everything turns into triangles in the end, even if you don't triangulate your meshes, because render engines (some if not all) require coplanar surfaces.

https://knowledge.autodesk.com/support/maya-lt/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/MayaLT/files/Polygons-overview-Planar-and-nonplanar-polygons-htm.html

| improve this answer | |
$\endgroup$
  • $\begingroup$ Renderman since circa version 17-19 now works on triangles yes. But dont add another answer just for commentary $\endgroup$ – joojaa May 19 at 6:15
  • $\begingroup$ I don't add answer for anything other than further understanding. $\endgroup$ – AggieVizzer2015 May 19 at 7:28
  • $\begingroup$ Yes but can you not combine this with your othwr answer? $\endgroup$ – joojaa May 19 at 8:24
  • $\begingroup$ This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review $\endgroup$ – Noah Witherspoon Jul 2 at 20:44
  • $\begingroup$ My replies were to specific replies. If there is repetition it is because someone is debating and I feel a need to make reinstate in different words so as to bring about a resolution or learn rather than continue to debate. $\endgroup$ – AggieVizzer2015 2 days ago
0
$\begingroup$

I know this is old but game engines/graphics cards run in "triangles" because that is how they calculate mesh. They do not calculate mesh in quads. That was something created to allow all of the features mentioned above to happen in 3D modeling. All quads are two triangles in the "engine". They are propagated that way to allow you to work with them efficiently. Essentially, all engines triangulate in the final process. The first answer here explains it correctly: https://gamedev.stackexchange.com/questions/66312/quads-vs-triangles/66314#66314

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ To me, the first part of your answer reads a little bit like "they do it because they do it". From the link you provided, I can see what you are intending to say (computationally more effective), but maybe you should clarify it a little bit more. $\endgroup$ – wychmaster May 28 at 6:56

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.