Triangles

How to 3D

Chapter 2: Triangles and Transformations

Triangles

Complex 3D scenes are made entirely of triangles. Our graphics cards know nothing of quadrilaterals, pentagons, hexagons, or any other polygon. They don't have to, because any polygon can be decomposed into triangles. Consider these regular polygons:

When viewing them in wireframe, we see that the square is just two triangles, the pentagon is three triangles, and the hexagon is four:

These polygons are regular, but any polygon can be decomposed into triangles, no matter its concavity, convexity, or irregularity. In fact, there are often multiple ways to break up a polygon.

Even complex, non-planar 3D shapes can be decomposed into a quilt of just triangles. Consider this cylinder:

If we need to render high-quality curved surfaces, we'll likely need many small triangles. This renderer produces an approximation of a sphere by subdividing a tetrahedron's four equilateral triangles into smaller triangles and pushing out the new vertices to the sphere's surface:

Increase the quality of the approximation by increasing the number of subdivisions. Rotate the sphere with the mouse.

We limit graphics program to just triangles because triangles have several advantages over other polygons:

In this chapter we explore how to form models out of triangles and render them in a 3D scene. By its end, you'll be able to answer the following questions:

These initial chapters focus on describing a model's shape. As we move into the third dimension, we will naturally feel a strong desire to add illumination and shading to communicate a shape's depth and orientation. However, we're not yet ready. Shape comes first.

Sequenced Triangles →