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- Position
- Normal
- Color
- TexCoo
Arrays or StucturesThere 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 CacheThis 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 IndexedPrimitive restartIndexed 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 CacheOn 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. - Optimal Grid Rendering - 2009
- NVTriStrip - 2004
- Simple lossless(*) index buffer compression - 2013
- Creating a basic IndexBuffer - 2011
PrimitivePointsEach 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. LinesLinesTwo vertex are us in a pair to form a line.Line StripAll the vertices form a single line with n-1 segments.Line LoopAll the vertices form a line loop with n segments.TrianglesTrianglesEvery three vertices form a triangle.Triangle FanEvery group of 2 adjecent vertices beoynd the first will form a triangle with the first one.Triangle StripEvery group of 3 adjacent vertices form a triangle.QuadsQuadsEach four vertex are used to form a quad.Quad StripEach quad beyond the first use two vertex from the last quad.Polygons ReferencePolygon 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 Normals and the Inverse Transpose - 2018 - Part1, Part2 and Part3 Storing vertex data: To interleave or not to interleave? - 2016 ACMR - 2009 Optimal Grid Rendering - 2009 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 |