Index Buffer Encoding

For most non-trivial meshes, we recommend using indexed draw calls. The additional level of indirection that indexing provides allows for vertex reuse along the seams between neighboring triangle strips. This reduces the need for physically duplicated vertices.

Well-structured meshes have good index locality, so nearby triangles in the model use nearby vertices in the attribute buffer, maximizing the benefits of caching. Also, index buffers should use every vertex between the min and max index used for a draw call. Any vertices that are not referenced are going to cause a loss in performance.

When implementing dynamic level-of-detail for simpler meshes, we recommend making contiguous vertex ranges for each level of detail required. While this adds an additional memory footprint for the duplicated vertices, it ensures minimal bandwidth usage due to improved cache efficiency.

The loss of cache locality from an inefficiency in vertex processing can be reduced by sparse sampling vertices from a high-detail mesh to generate a lower detail version.

The following image shows how different levels of mesh detail are partitioned, with each level of detail stored as a continuous block of vertex data in memory:

Shows how different levels of mesh detail are partitioned and stored in a block of vertex data in memory.

Previous Next