Vertex buffer

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Created page with "A vertex buffer is a component of a render chunk which stores an array of vertices. A vertex buffer in E2 is limited to 65k vertices; any mesh which is larger ...")
 
m (Windwalkr moved page Vertex Buffer to Vertex buffer)

Revision as of 19:44, 13 October 2017

A vertex buffer is a component of a render chunk which stores an array of vertices. A vertex buffer in E2 is limited to 65k vertices; any mesh which is larger than this will be split into additional render chunks, each with their own vertex buffer.

Vertex Format

Each vertex in the buffer contains the coordinate (XYZ) of the vertex in 3D space along with various metadata, possibly including:

  • Texture UV coordinates.
  • Normal vector.
  • Tangent vector.
  • Animation bone weights.
  • Color.
  • etc.

Correlation with Polygons

There is no true correlation between the number of vertices and the number of polygons in a mesh. A number of approximations can be made, but these may be wildly inaccurate depending on the nature of the mesh:

  • Each polygon in the mesh is a triangle, with exactly three vertices.
  • However, the vertices may be shared between polygons. A fully contiguous triangulated mesh has three polygons sharing each vertex, resulting in an overall average of one polygon per vertex.
  • More complicated meshes might have additional polygons sharing each vertex.
  • Discontinuous meshes might have less polygons sharing each vertex.
  • Even where polygons appear to share a vertex due to their 3D shape, they may in fact be using separate vertices because the vertex metadata differs per polygon.

Large and well smoothed meshes are likely to approach the one-polygon-per-vertex average because any discontinuities in shape or metadata are likely to be in the minority.

No mesh should have more than three vertices per polygon.

Correlation with Indices

An exceedingly inefficient mesh will have one index per vertex. An efficient mesh will approach three indices per vertex. All meshes will have exactly three indices per polygon.

Personal tools