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

Generating Meshes of a Sphere - 2021

Generating Primitive Shapes in C++ - 2021

Triangle Grids - 2021

meshoptimizer - 2021

Meshlete - Chop 3D objects to meshlets - 2021

Signed Distance field (SDF) - 2021

3D SDF Primitives in WGSL - 2021


A new way to handle vertex data - 2020

Learning from data - 2020

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

Learning from data - 2020

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

New geometry pipeline in Magnum - 2020

Interior SDFs - 2020

Glyphs, shapes, fonts, signed distance fields. - 2020


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

Non-linear sphere tracing for rendering deformed signed distance fields - 2019


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


Matching of geometrically and topologically changing meshes - 2017

Triangle Reordering for Efficient Rendering in Complex Scenes - 2017

Half-edge data structure considered harmful - 2017

Optimal grid rendering is not optimal - 2017


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

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


Polygon Triangulation - 2014


Creating a basic VertexBuffer - 2011

Create your own Vertex Structure - 2011

The hazards of a binary file format - 2011


Vertex cache optimizer - 2010


ACMR - 2009

Optimal Grid Rendering - 2009


Fun with convex polygons

Silhouette Detection

Introduction to Polygon Meshes

How to Flip Triangles in Triangle Mesh

Neural 3D Mesh Renderer

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

Meshlete - Chop 3D objects to meshlets

Tech Art Chronicles: What Are SDFs Anwyay?

FBM detail in SDFs

There is no S in SDF without the Distance Fields!

Signed Distance Field (SDF)

Discover 3D content optimization with Simplygon