Mathematics for Graphics and Games
Mathematics is a very important part of making graphics and games. Fundamentally when we're working in CG we're trying to make a virtual world, which usually has some similar aspects to our own world. It therefore makes sense to look at how our own world works. This is the study of physics. Mathematics is the language used to express physics, so we need to look at this too. More than this though, we need to make our virtual world in the computer and the computer only knows about maths.
The most fundamental maths concepts we need to be competent in are vectors and matrices. I like to justify this as follows:
- 3D models (especially for real-time graphics) are dominated by meshes. A mesh is a collection of triangles, arranged to appear like a solid object.
- A single triangle is described by three vertices.
- A vertex has a position in space, which is best described using a position vector.
- Describing a vertex using a vector allows us to modify them using matrices.
- We can use a matrix to encode a transformation to allow us to move vectors.
- Thus, we can use matrices to move our objects around, which is kinda helpful.
While there are maths libraries that will largely abstract these for us, it's still useful to have an idea of what's really going on. It gives us a more intuitive understanding which can help solve a wider range of problems and it can help when things go wrong and we need to do some debugging.