# Triangle - Why is it the basic building block for complex shapes

I was recently learning about OpenGL and computer graphics development. I have a question regarding the usage of triangle as the basic building block, or basic shape to develop complex shapes. Is there a particular reason? Or just something that "stuck"?

• Triangles are the basic building block in geometry (mathematics) as well because they are a simplex - the smallest number of points needed to make a shape in the given dimension. Jul 7, 2019 at 4:28
• not only tris, pathtracing/raytracing techniques does not require triangles codepen.io/strangerintheq/pen/OKVVOW Jul 22, 2019 at 13:06

Triangles are always flat, unlike a quad which can be made in a way that is bent / not all vertices on the same plane.

If you were to interpolate say vertex normals across each scanline, on a 4-edge bent quad it will render with horizontal (scanline) artefacts. If you made that same bent quad out of triangles, it will render correctly as each triangle has a different normal slope.

That's one reason why triangles are preferable for scanline rasterising

• Non-planar quads would also be painful in that they can have 2 interection points per pixel, i.e. have an implicit silhouette edge. Jul 10, 2019 at 9:21

In computer graphics, people are interested in modelling the surface of the objects. And, since we are in the discrete world of computers, we need a discrete representation for surfaces, where we can easily check for stuff like intersections and angles, both vital for rendering.

The triangle makes it very easy to compute intersections and surface normals, but also has some useful features: it is always convex (if not degenerate), which means that the mathematics is a lot simplified. Being so basic, you can also split pretty much any shape in triangles.

But keep in mind that there are other basic shapes. Some hardware supports quads or nurbs, although it's much less common.

• Quads especially but (arbitrary) Polygons in general could be used in older versions (of OpenGL anyway). I am not exactly sure, but I think there also a hardware optimizations for the triangle related maths you do in rendering.
– Tare
Jul 3, 2019 at 8:40