Index buffer

From TrainzOnline
Jump to: navigation, search

An index buffer is a component of a render chunk which stores an array of indices. Each "index" is an integer which indexes into the corresponding vertex buffer. Each triplet of indices in the index buffer defines a single polygon (also known as a "triangle" or "primitive"). This indirect technique allows multiple polygons to share vertices- this is a significant performance saving as a single vertex consumes far more memory (and memory bandwidth) than a single index, and a shared vertex only needs to pass through the vertex shader once.

Correlation with Polygons

As all Trainz geometry is built with triangles, there are exactly three indices per polygon.

Where a mesh is built from higher-order polygons in the 3D modeling software, the polygons will be split into triangles either during the export process or the import process. This may lead to an increase in the number of polygons counted in the mesh, but does not lower performance. For performance analysis purposes, all polygon counts should be performed using triangles.

Impact on Performance

Index count is directly correlated with polygon count, which is one of the primary concerns when optimizing for performance.

Personal tools