Matrices, Transformations, and Perspective in WebGL
Rakesh Baruah · Apress eBooks · 2020
Until now in our journey along the WebGL pipeline, we have conveniently avoided any talk of linear algebra. While the subject used to give my heart palpitations too, I’ve learned over time that programming 3D graphics provides a helpful, visual tool for the understanding of what linear algebra is. In short, linear algebra is the manipulation of coordinate space in ways that: 1) keep the xyz origin at (0, 0, 0); and 2) keep parallel lines parallel. Of course there are many more complicated applications of linear algebra such as in neural networks and quantum physics. However, I have found for an intuitive understanding of the role linear algebra plays in 3D computer graphics, the two fundamental features I’ve presented suffice. By maintaining the location of the origin in three dimensions and the parallel nature of parallel lines, linear algebra helps XR developers compute transformations of shapes in context and without unintended distortion. Linear algebra maps the three dimensions of our world onto the two dimensions of our screens, and in concert with graphics hardware it does so ridiculously fast.