Sub topic 1
Vertices: the points of a mesh
Prerequisites
This chapter assumes you know basic 3D coordinates (x, y, z), vectors, and introductory dot and cross products. You should also be able to read simple Python code. The later chapters use vertices to explain edges, faces, topology, and surface attributes.
A vertex is a point in 3D space. It usually stores a position such as (2.0, -1.0, 0.5), where the three values represent the point's coordinates along the x, y, and z axes.
A vertex is the smallest geometric element in a polygon mesh. It does not have a visible surface by itself. Surfaces appear only when vertices are connected into edges and faces.
A vertex is more than a position
In a simple mesh, a vertex can be represented by three numbers:
vertex = (2.0, -1.0, 0.5)
x, y, z = vertex
print(f"x={x}, y={y}, z={z}")The position is geometry: it describes where the point is located. The connections between points are topology: they describe which points belong to the same edges and faces.
Moving a vertex changes the mesh's shape but does not necessarily change its connectivity. For example, moving one corner of a cube changes its geometry while leaving the same six faces and their vertex connections in place.
Vertex coordinates and coordinate spaces
Coordinates are interpreted in a coordinate space. In object space, a vertex is measured relative to the object's own origin. A modeling application can then apply transformations such as translation, rotation, or scale to place the object in world space.
A vertex at (1, 0, 0) might therefore appear at a different world position after the object is moved. The stored object-space position remains unchanged.
Keep these ideas separate:
- A position is a point, not a direction.
- A vector describes a difference between positions.
- A transformation can change a position's coordinate representation.
- The vertex's index is an identifier, not a coordinate.
Vertex indices
Meshes normally store vertices in a list. Each vertex has an index based on its position in that list. Other mesh data refers to these indices instead of copying the full coordinates repeatedly.
vertices = [
(0.0, 0.0, 0.0), # index 0
(1.0, 0.0, 0.0), # index 1
(0.0, 1.0, 0.0), # index 2
]
triangle = (0, 1, 2)
for index in triangle:
print(index, vertices[index])Here, triangle does not contain three positions. It contains references to positions in vertices. This indexed representation saves memory and makes shared corners explicit.
A common error is to confuse an index with a coordinate. Index 2 means “use the third item in the vertex list.” It does not mean the point is located at (2, 2, 2).
Vertex attributes
Production meshes often store additional data associated with vertices or with face corners. Examples include:
- A normal, which influences lighting.
- A color, which can be interpolated across a surface.
- Texture coordinates, also called UVs, which map a 2D image onto the mesh.
- Skinning weights, which control how an animated character deforms.
The word “vertex” can therefore mean different records in different systems. A geometry vertex may be shared by several faces, while a rendered vertex may need separate normals or UV coordinates for each face corner. A hard edge or a UV seam can cause one geometric position to be stored more than once in the renderable mesh.
Vertices provide the positions from which a mesh is built. Edges connect them, and faces use those connections to describe surfaces. Understanding indices and the difference between geometry and topology makes the remaining mesh structures easier to inspect.
Exercise
In the list [(0, 0, 0), (2, 0, 0), (0, 2, 0)], what position does the face reference (2, 0, 1) use for its first corner?
Show answer
It uses vertex index 2, whose position is (0, 2, 0).