Polygons

Mesh rendering is made up of vertices that are connected to form primitives that is drawn. Both the vertices and the primiteves can have attributes that modify how things are drawn. The most common primitive used is triangles.

Vertices

A vertex is composed of attributes that are then interpolated over any primitive that use it. The only one that is almost always needed is position. What data one need to send in depends on the shader or settings on use for the primitive.

    • Position
    • Normal
    • Color
    • TexCoo

Arrays or Stuctures

There are two common ways to feed the attributes to a graphic API. The first is to have one array for each form of attribute. The second is to have all the attributes of a vertex in a structure and have an array of these structures. Most of the time the same functions are used to map the attributes for the API but in the second case one use a stride parameters to skip over the unrelated data for the current attribute.

Pre Transform Cache

This cache stores the untransformed vertex attributes read from memory. This will be more efficiently used when a structure system is used to feed the attribute data.

Non-indexed or Indexed

A non-indexed mesh use the vertices in the order they appear in the buffers to form primitives. A indexed mesh use reads a value from a index buffer first. Then it use that index to get the vertex from the vertex buffer. That way a vertex can be reused for more then one primitive and cut down on the amount of vertex data that is needed.

Primitive restart

Indexed rendering can use primitive restart. That is a special index that is not used to select a vertex but rather to start a new primitive with the next index. That way one can use more then one polygon or triangle strip in the same draw call. A common value for primitive restart is the max value of the integer used as index or it can be a custom value that is set using the graphic API.

Post Transform Cache

On GPU's there is a small memory buffer that keep the latest vertex shader transformed vertices. If the same vertex i used again the GPU can avoid doing the transform and use the cached content. The check to see if it is the same vertex is done by using the vertex index so this only works in indexed mode.

Primitive

There are five groups of primitves used with mesh rendering. They are points, lines, triangles, quads and polygons.

Points

Each vertex in the vertex stream is a point. Each point is drawn as a screen-aligned square that can be given a texture. The size of the square can be set for all the points or for each in the vertex shader.

Lines

Lines

Two vertex are us in a pair to form a line.

Line Strip

All the vertices form a single line with n-1 segments.

Line Loop

All the vertices form a line loop with n segments.

Triangles

Triangles

Every three vertices form a triangle.

Triangle Fan

Every group of 2 adjecent vertices beoynd the first will form a triangle with the first one.

Triangle Strip

Every group of 3 adjacent vertices form a triangle.

Quads

Quads

Each four vertex are used to form a quad.

Quad Strip

Each quad beyond the first use two vertex from the last quad.

Polygons

Reference

Polygon Triangulation - 2014

Creating a basic VertexBuffer - 2011

Create your own Vertex Structure - 2011

Vertex cache optimizer - 2010

Fun with convex polygons

Silhouette Detection

Introduction to Polygon Meshes

Matching of geometrically and topologically changing meshes - 2017

Triangle Reordering for Efficient Rendering in Complex Scenes - 2017

Half-edge data structure considered harmful - 2017

How to Flip Triangles in Triangle Mesh

Neural 3D Mesh Renderer

Normals and the Inverse Transpose - 2018 - Part1, Part2 and Part3

Storing vertex data: To interleave or not to interleave? - 2016

meshoptimizer

ACMR - 2009

Storing vertex data: To interleave or not to interleave? - 2016

Optimal grid rendering is not optimal - 2017

Optimal Grid Rendering - 2009

Triangles Are Precious - Let's Treat Them With Care - 2019

Meshlete - Chop 3D objects to meshlets

Messed up 3D Meshes: A case study in the limits of integer floating point

a little thread on a neat way to interpolate across a triangle!

Learning from data

How to Correctly Interpolate Vertex Attributes on a Parallelogram Using Modern GPUs?

Meshlete - Chop 3D objects to meshlets

A new way to handle vertex data - 2020

The hazards of a binary file format - 2011

Learning from data - 2020

New geometry pipeline in Magnum

Interior SDFs

Non-linear sphere tracing for rendering deformed signed distance fields