Do you think that – within the graphics programming sector – the geometric algebra approach may take over from today’s conventional applied maths?
I think that, as people learn more about geometric algebra, it will replace some parts of conventional maths, other parts should not be replaced. We have to find a good balance. Think of partial differential equations in game balancing… For instance, take X number of enemies and Y number of good guys, confine both to certain paths that they can take and then find me the stable state this game can lead to/ If you express these ingredients with a transition matrix which you can exponentiate, it will simply show you a stable dynamic state in order for the game designer to optimally feed it, instead of trying a shot in the dark. This sort of problem should be answered by matrices. It is far from obvious to switch to geometric algebra for such a context.
Okay let’s talk then maybe about the – within the graphics programming sector – popular quaternions. Will they continue being useful to program rotations, because you showed us in your workshop (‘Animating a spider’, as worked exercise in Inverse Kinematics) how these very rotations can simply be achieved by combining two reflections?
Indeed – and here comes the fun part of your question – you can take a better look at such a quaternion and think ‘these are not some imaginary units i, j, and k, but the basis planes e23, e31 and e12 respectively’ which shows you that quaternions consist of two reflections. In other words, if you need to rotate a vector, you simply take the geometric product of it together with its desired rotation image, because their result is that required rotation quaternion! In other words, better forget about the so-called 4D (hyper)sphere misinterpretation of quaternions.
Reflections are key: the combination of any two rotations (not necessarily sharing the same centre!) yields a new rotation but which can only be predicted by analysing how their successive underlying reflections cancel out. This holds as a litmus test for any sound understanding of quaternions, and all non-geometric algebra alternatives fail it.
Do you think that geometric algebra should replace more than one applied maths course?
Well, any math course that spends time on explaining quaternions is strongly recommended to first teach the geometric algebra basics in order to then re-discover quaternions transparently in their natural habitat. But of course, this requires some reshuffling of the actual math curricula in order to make that happen. Hence it takes some time for academia to keep track with ongoing innovations in the industry. Digital Arts & Entertainment (Howest) seems to be in the leading position to take this up.
Is game development amongst the first domains where geometric algebra finds its way?
Well, Geometric Algebra got picked up again by David Hestenes in physics, where it is obviously a better approach to describe nature than all other options. However, the physics community is very different from the game development community, in setting and settling their certain ways of measuring and proving things. And hence ending up less open-minded to new paradigms. Physicists say, ‘a new paradigm does not produce new nature.’ This is in contrast to game developers, who embrace new techniques that have more benefits: less and more transparent code, less memory consumption and better runtime performance. It is all they dream of. I consider game and graphics development as a science in which it is apparent that people are taking it up, turning to geometric algebra. I can only hope we will be able to do what physicists haven’t been able to.
Perhaps that is also the case because, in game development, creating physically accurate objects is a lesser goal than quickly and easily visualising images?
One could assume this, but as it turns out, it is almost on the contrary. To give you an example, when I started game programming on my Commodore-64, my 8×8 pixels sized cow did not look much better than the famous ‘spherical cow in vacuum’ (which is a common gag amongst physicist, mocking their oversimplified preconditions in thought experiments). Nowadays we, as game developers, raised rendering, simulation and animation to such an absurd level that I can barely distinguish my cow from a video, while physics is still stuck in its spherical cow (in vacuum). Sometimes you will see spill-over of game development (simulation) to science (nature). Let me illustrate this with how glacier simulation experienced a big leap forward because of Disney’s production called ‘Frozen’. Glacier physicists realised a less accurate snow and ice simulation after 20 years than the Disney programmers did in only a couple of years. So, while game programming used to be laughed at when it took off, today our physics technology starts to be useful for science too. It is very fascinating to witness that evolution.
Do you see yourself giving more Geometric Algebra programming workshops in the future?
Of course, I made this library with all these little useful examples because I felt the need for them. When I started embarking on geometric algebra, that did not exist. And even though I do not only do game development anymore, I want to keep guiding the community to the best of my abilities. One of the plans I have is setting up a YouTube-series where we program from scratch and at a steadier pace (than the accelerated workshop at GAME23). In this respect I felt somehow sorry for Wednesday’s audience at GAME23, which we may have overloaded during the first 40 minutes, especially for the ‘first-timers’. I doubt they were able to appreciate and apply Geometric Algebra to the full. The same goes for today’s workshop where it would have been so much better to give the audience more time, to take it up and to go more into detail.
I went to the workshop thinking “will I actually be able to actually do this?” despite the fact that I attended most of the GAME23 talks. But as I took off with the first exercises, it immediately felt so cool because of how easily we drew lines, reflected, intersected and – top of the bill – instantly translated it all from 2D to 3D!
(Nodding) Even to 4D! That ‘feeling’ of convenience as you name it had to be experienced at this edition of GAME after we had overlooked it at the first edition in 2020. Another thing is that every operation in geometric algebra is… geometric in a way that its expression relates naturally to a picture. Complete transparency! And pictures always make sense: what you see will tell you exactly what is going on in order for you to use thevisual feedback to debug, adapt or improve your source code. I can assure you that geometric algebra is a very expressive and really powerful way of coding. Really addictive too.
How much is geometric algebra growing at the moment?
There are statistics about that: for instance via github, via the geometric algebra software-libraries (Pablo Colapinto, Jeremy Ong, …)… There we see a rise in the number of libraries and stars similar to the start of an exponential function, which started after the SIGGRAPH course (2019, Gunn & De Keninck). There is definitely a lot more interest than there ever was. It’s an exciting time to be alive!
Can you see the big game engines (Unreal, Unity, … ) implementing geometric algebra anytime soon?
Well, I cannot speak for their time schedule, but I can confirm there is interest from them and that we are talking to them. This again with an extra boost since the latest GDC talks (March 2023, Hamish Todd, …). Epic Games is showing interest and I have been talking to Unreal and Unity myself, but the dust has not yet settled. In a way these are also very early days concerning decision-making: what and how to implement geometric algebra? How do you prioritise? Which methods do you integrate first? How do you convert the existing engines? The implementation of geometric algebra is a very fundamental change, unlike their usual incremental upgrades.
Will geometric algebra be introduced to the existing engines rather than making a new one from scratch?
That indeed is what we’ll probably see happening first. And for PGA (Projective Geometric Algebra) it is pretty easy: its primitives are homogeneous coordinates, its lines are Plücker coordinates, … so its datatypes are the same. Of course, it is not as easy for classic transformations, which cannot be stored as rotors. Adopting PGA transformations will take plumbing by conversion and reconversion. Quite a lot of the big engines (3D-Maya, Disney, …) are already implementing dual quaternions (often for skinning), which map one-on-one to the PGA rotors. That means the landscape is various. There are places where geometric algebra will transition to quickly, and others where it will still take more time because of the more fundamental changes it requires.
Given that in the game industry everyone likes to stay ahead, I guess that given the performance increase and the ease-of-use that geometric algebra offers, it will grow exponentially sooner rather than later?
Doing things faster is a short-term optimisation, but the real optimisation lies in doing things smarter. This is because you can then start to program on a next level. The best calculation is the one you haven’t done, right? It takes some maturity for a programmer to realise this, but that is where I expect the next big killer application will come from. Not just because its performance will be better, but because it can leave out obsolete computing loads. Let me illustrate this thrice.
Doing things faster is a short-term optimisation, but the real optimisation lies in doing things smarter. This is because you can then start to program on a next level. The best calculation is the one you haven’t done, right? It takes some maturity for a programmer to realise this, but that is where I expect the next big killer application will come from. Not just because its performance will be better, but because it can leave out obsolete computing loads. Let me illustrate this thrice.
Firstly, geometric algebra offers a simple and robust formula that gives you the volume of any triangular mesh, which also works if you want a slice of that volume. Let us compare this to the conventional approach. Doing this in the classical manner you would require you to slice the mesh, to subdivide all of the triangles which go through the slice plane, to then throw half of those away, to then generate geometry to get a cap and to finally calculate the volume of the resulting mesh. All of these latter classical calculations are rendered obsolete by the geometric algebra approach. Here, geometric algebra does not only offer a performance gain (by avoiding classical calculations), but also deepens your insight into the geometry of this problem: you understand how volume slicing works. That is what I call true optimisation. It is not about the little wins in clock cycles, but about the big wins (calculation avoidance and insight improvement).
Secondly, let us look at Lumen (the global illumination and reflection system) and its challenges of finding the planes where you need to apply the signed distance fields. Its top challenge is: ‘given some random geometry, find the optimal planes by which the signed distance fields give you the best representation of the scene’. Given a certain setup and then retrieving the optimal planes for it, that is the core problem where the real optimisation lies. If you can do this a lot better and with less planes, then you score the big performance win. When given a problem to be solved, let either linear algebra or geometric algebra be the best fit to it. There will always be a minimum of complexity and computation to be done by the compiler. The big wins are not within that compiler level, but on the higher source code level: which algebra is the best fit?
Let me thirdly illustrate where Geometric Algebra’s big win lies by handling the intersection of two straight lines. In PGA (which is a projective geometry) two lines always intersect (either in a point or at infinity), while in a classic code this would take an if-statement which branches your source code so that only your data can tell which the fastest route is to execute.
In conclusion, comparing geometric algebra-code to classical code, purely on clock cycle counts, is wrong because that fails to show the big wins like the unifying aspect. Moreover, when you would only occasionally use geometric algebra code within a classic engine, you would pay the conversion costs for that. It is so much more rewarding to completely commit to the geometric algebra approach within your system, because then you would score all the big wins without conversion costs. Because of this engagement, it will still take some time for the big players to turn towards Geometric Algebra. But at the same time, there is without a doubt a Geometric Algebra-based killer application coming, but rather within the high-level range of algorithms.