# Math topics for 3D graphics programming [closed]

I understand that the following math topics are required for 3D graphics programming. I have started doing some of them in my math course. Can someone point me in the direction of a resource that explains how they apply? What graphics/game problems are they used to solve?

• vector math
• matrix math
• quaternions
• linear algebra

As far as I can see these are all linear algebra/matrix topics. Are there any other topics required?

Linear Algebra is the foremost discipline for 3d graphics programming simply because it's the mathematical language for describing spatial geometry. Your other three topics are really just subsets of linear algebra:

• Vectors are a way of thinking about points in space
• Matrices are ways of thinking about transformations of space and objects: translating objects, scaling them, etc.
• Quaternions are a natural representation for a specific subgroup of those transformations, the rotations
• etc, etc.

As far as other relevant pieces of mathematics for 3d graphics programming, the one I'd recommend that doesn't get nearly enough love is computational geometry. A lot of natural problems boil down to topics in computational geometry:

• One of the most natural ways of defining a volume from a set of points (for instance, to define an audio volume where a specific background noise will play, or a fog volume, or the like) is to find the Convex Hull of the points; there are good algorithms for doing that in 2 and 3 dimensions, but even the 2d algorithms aren't immediately obvious.
• The problem of being able to determine what objects are near a given point or are near each other (for instance, to reduce the number of objects that have to be checked for possible collisions, or to figure out which enemies will notice the players at a given point) gets into the field of Geometric query problems and to spatial partitioning schemes (and thus into structures like BSP trees and octrees). The same general ideas are also used to answer 'line tracing' queries (for instance, 'what does this laser beam hit?')

After that, I'd encourage looking into basic calculus and particularly numerical methods for differential equations; these are less relevant to 3d graphics per se than they are to 3d physics, but in general the two topics are pretty tightly coupled (even for simple problems of kinematics - for instance, for character animations and the like) and some knowledge of both will substantially enhance your knowledge of either; it's difficult if not impossible to work the relevant physics without the same core linear algebra knowledge as graphics uses, but at the same time having the physics knowledge provides another point of reference for understanding the topics in graphics.

• This was a fantastic answer, Steven, thank you. I loved your summaries of how to think about vectors, matrices and quaternions (sadly, more informative in 2 seconds than my current linear algebra lecturer) You have also given me a better understanding of the kinds of modelling challenges posed to 3D graphics programmers. Cheers! – Katherine Rix Jun 9 '11 at 9:10

Here's a great intro http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-2/

• Ah, from the guys who did Lugaru! I have not had a chance to read through this yet, but I have a 6 week vac now and this will be part of what I take a look at - thanks! – Katherine Rix Jun 9 '11 at 9:15

http://www.dickbaldwin.com/KjellTutorial/KjellVectorTutorialIndex.htm is a pretty good and straightforward tutorial about 2D/3D vector math AND it's applications on graphics programming.

• I've had a look at this, very nice. Starts with the basics which is good for a beginner like myself - thumbs up! :) – Katherine Rix Jun 9 '11 at 9:11

If you are familiar with Cartesian coordinates, then the application of the above topics to computer graphics should be pretty clear. There are tutorials such as these for OpenGL that will help to clarify the application of math to solving basic display problems, e.g. how to make a wire-frame model appear to rotate. The Wikipedia article on perspective drawing might help with a bit of historical background.

Beyond that there are many display topics that benefit from mathematical formulation. For example, 3D solids are usually represented by triangulations of their surface. How do we show only that part of the surface that an observer "should" see (hidden surface/line algorithms)? If an object is to be illuminated from a particular source/direction, how does this interact with perspective to give a convincing surface rendering?

Beyond that there are all sorts of interesting modelling topics, such as animation of a mist or a flame. But the transformation of coordinates, as your list of topics seems to center on, is a staple of all later advances.

Practical Linear Algebra and Fundamentals of Computer Graphics are two very good books that will cover the topics you mention (and their use within computer graphics), if you're in to books and such.

• I am very into books and such :) Thanks for the recommendations. – Katherine Rix Jun 9 '11 at 9:18

They are not all required. Vector maths are all over 3D graphics, you might be able to set up the geometry without knowing the finer points of vector maths, but stuff like bump maps are going to get really hard, and you'll fall through on physics.

Quaternions simply offer a different description for some of the maths, it may be nice to have, but it's certainly not needed as more conventional mathematics suffice for describing any calculation you can do with quaternions.

Matrix maths and linear algebra are very closely related, most of all it describe linear operations on sets of numbers. But again, it's just another way of describing some things that could be described with vectors and algebra.

I don't know if you consider it to be just a part of basic maths, but trigonometry certainly needs to make the list as well.

• I've seen a few mentions of physics so far - can you tell me what conecpts you are referring to here? I haven't touched the subject in 12 years (ie since high school) and frankly I hated it. Perhaps I will find its application easier to stomach though. – Katherine Rix Jun 9 '11 at 9:20
• Newtonian physics, primarily collision resolution. You might not have been taught this stuff in high school, but it's all very mathematical, so if you just like maths you should be good. – aaaaaaaaaaaa Jun 9 '11 at 12:33