I'm building a simple 3d software renderer, and this can't get "truer" then reality. Everything in game dev in general is infact linear algebra. After learning this fact, I'm astonished that no game dev tutorial talk about this enough.
There is one place in the standard raster pipeline that isn't *technically* linear algebra. That'd be the perspective divide because obviously 1/x isn't linear.
Affine functions also aren't linear, but thanks to using 4d homogenous coordinates we can get away with making all of that linear. (This is a fancy math way of say ax+b instead of just ax. The former is not linear but the latter is).
You seem to be violently agreeing with me? All I said was that the presence of nonlinear transforms doesn't make it "not linear algebra". I didn't claim that those transformations are actually linear ...
If that was your entire point, I'm not sure what you said to me up there. All I said was certain transforms in the pipeline aren't linear, and that is correct.
Perspective division is genuinely not linear algebra. You can cheat affine transforms by bumping up a dimension (3d -> 4d). That's one reason why GPUs use 4x4 matrices and not 3x3.
The perspective divide causes no end of conceptual problems because it means something non-reversible happens after the geometry shader and before the fragment shader. That makes it impossible to back your way out just using equations. This is why we often pass world coordinates directly from prior stages to the frag shader, so we have a sort of "inverse function" available to us when we normally wouldn't be able to know.
Some might say, "Well, there's also calculus, etc." There's truth to that... But in calculus, what's a derivative? It's a linear transformation. Okay, fine, but what about integrals? Also a kind of linear transformation (a linear functional). People are usually taught these facts as the "sum rule" or "constant multiple rule," but those are just the defining properties of a linear transformation! Multivariable calculus, in particular, makes way more sense if you learn linear algebra first (most students don't, at least in the US).
This exact gap is why I teach advanced math one-on-one... It's much easier to connect the dots for someone's specific background, especially in computer graphics. Learning linear algebra is actually easier for graphics devs because it gives really good reasons for the math to be the way that it is. In this context, we can discover matrix multiplication from scratch very easily, actually! But it's hard to find tutorials, even ones aimed at graphics devs, that really make this clear. Argh. If anyone here is hitting a wall with their linear algebra, feel free to shoot me a DM!
the Feynman lectures (i know, i know) has a famous quote:
Finally, we make some remarks on why linear systems are so important. The answer is simple: because we can solve them! So most of the time we solve linear problems. Second ( and most important), it turns out that the fundamental laws of physics are often linear. The Maxwell equations for the laws of electricity are linear, for example. The great laws of quantum mechanics turn out, so far as we know, to be linear equations. That is why we spend so much time on linear equations: because if we understand linear equations, we are ready, in principle, to understand a lot of things.
Linear algebra and sometimes software architecture(if you’re building performant stuff) are literally the only two skills you need to do this stuff truly.
I keep slowly adding to a 3d engine I'm making. every time I think "this next part is going to take a lot of complicated effort". and I come back to it and it's just more algebra
There's a lot of data structures and algorithms when you get passed the basic implementations as well, and some of that can be expressed with probability math, graph theory etc... but it's almost all just organizing when the linear algebra happens under the hood.
View all comments
174
u/[deleted] Mar 15 '26
I'm building a simple 3d software renderer, and this can't get "truer" then reality. Everything in game dev in general is infact linear algebra. After learning this fact, I'm astonished that no game dev tutorial talk about this enough.