|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
− | __NOTOC__
| + | #REDIRECT [[Polygon]] |
− | <!-- ## page ported from http://www.ericchadwick.com/portfolio/glossary/examples/polygons.html. -->
| + | |
− | <!-- ## my recommendation for this page is that it becomes a "euclidean geometry" page that has a section on faces, edges, and verts, then also triangles, quads and n-gons as subsections of face. From here, also include information on how they are handled in-engine, as well as the issues with quads (non-manifold etc.). -Brandon Phoenix, 8/10/10 -->
| + | |
− | | + | |
− | {{:[[OutOfDate]]}}
| + | |
− | | + | |
− | = Polygons =
| + | |
− | | + | |
− | == Polygon Storage Methods ==
| + | |
− | | + | |
− | {| border="1" cellpadding="2" cellspacing="0"
| + | |
− | |-
| + | |
− | |}
| + | |
− | | + | |
− | A [[triangle]], a [[quad]], and an [[n-gon]].
| + | |
− | | + | |
− | All modern real-time 3D [[engines]] support triangles. Some of these support quads and/or n-gons, but all polygonal engines convert them down to triangles at [[render]] time, a step known as tessellation. The rare engines that support non-polygonal geometry, often use other methods to create objects, like [[voxels]].
| + | |
− | | + | |
− | With a triangle-only engine, you can still use polygons with more than three sides, but the engine always sees them as [[tris]] because it either tessellates them at runtime, or on import. For each triangle, it stores three [[vertices]] that define the shape.
| + | |
− | <!-- ##need sections on verts, edges, etc. -->
| + | |
− | | + | |
− | However, if you are able to use quads, the engine is then able to store them as only four vertices apiece, instead of the six that would be required to store the two triangles that make up the square shape. Engines that support quads usually support plain old triangles as well, for those difficult shapes where quads won't work. Quads save on the size of the [[geometry]] file, which saves [[memory]], and it saves on the amount of calculations the engine has to do to [[transform]] the quads before rendering, which can ultimately speed up your [[frame rate]]. Every little bit helps.
| + | |
− | | + | |
− | The same holds true for n-gons, except they can save even more vertices. The hexagon, for example, is stored as only six vertices, instead of the twelve verts needed for plain triangles to describe the same shape. Remember, your engine must support quads or n-gons for this to work, and there are some restrictions-- see below.
| + | |
− | <!-- ##is this still accurate? Seems that most modern engines (that I've worked with) don't support ngons, or will tessellate on import anyways, defeating the purpose. -->
| + | |
− | | + | |
− | The term "n-gon" does not always mean a polygon stored in this special vertex-saving way. There really isn't a specific term for this. You just have to spell it out anytime you refer to these special polygons. Which really isn't all that often, as most engines do not support them.
| + | |
− | | + | |
− | There are many ways to reduce vertex counts, like using [[strips]] and [[fans]].
| + | |
− | | + | |
− | == Non-Coplanar Quads ==
| + | |
− | | + | |
− | {| border="1" cellpadding="2" cellspacing="0"
| + | |
− | |-
| + | |
− | |}
| + | |
− | | + | |
− | These two [[quads]] illustrate a problem that some [[engines]] have when a quad's [[vertices]] are not [[coplanar]] (on the same plane). Each quad has their vertices in the same shape. I put the quads inside grayed-out bounding boxes to make the perspective easier to see.
| + | |
− | | + | |
− | Some engines do not allow non-coplanar quads to exist-- instead they are automatically converted to [[triangles]]. However, if the engine allows non-coplaner quads, a problem can occur where both quads have their [[vertices]] in the same layout, and so the engine has to convert the quads to triangles before rendering. The problem is that it does not know how you want the quad divided, so it arbitrarily decides where to put that interior edge. The quad could either be a ridge (left) or a valley (right).
| + | |
− | | + | |
− | This leads to some ugly artifacts, like a character's shoulder looking cut-into instead of muscled. Another problem happens if you are animating the quad's vertices, like with [[morphing]]-- the engine converts the quad into triangles, and on each frame it arbitrarily decides where to put that interior edge, so it ends up constantly flashing between ridge and valley.
| + | |
− | | + | |
− | If your engine supports quads, make sure your quads' vertices are coplanar.
| + | |
− | | + | |
− | == Concave Quads ==
| + | |
− | | + | |
− | {| border="1" cellpadding="2" cellspacing="0"
| + | |
− | |-
| + | |
− | |}
| + | |
− | | + | |
− | These are two [[quads]] that illustrate another problem, similar to the Non-Coplanar Quad. Each quad has their [[vertices]] in the same shape. The red lines are the interior edges between the two [[triangles]] that make up each quad. The darker triangle in the quad on the right is overlapping the quad's other triangle, which is larger.
| + | |
− | | + | |
− | The vertices of these two quads are actually [[coplanar]]-- the problem is that they form a [[concave shape]], but the engine still has to make the quad into two triangles at [[render]] time. It doesn't know that you want it to look like the one on the left, so it may create the one on the right.
| + | |
− | | + | |
− | What's so bad about that? Since the two triangles overlap in the same plane, the engine doesn't know which to draw in front of the other, so it flashes from one triangle to the other from frame to frame. Not very professional looking. If you need this shape, it's better to go with plain triangles.
| + | |
− | | + | |
− | ----
| + | |
− | [[Category:Glossary]]
| + | |