4 ms·
GA is much slower in practice and takes more to store. In places speed and cache are important, quaternions are much better. Game engines don't need much if an
by ChrisLomont 5y ago
GA is much slower in practice and takes more to store. In places speed and cache are important, quaternions are much better.
Game engines don't need much if anything from GA (and I've written about using GA decades ago for software, and did it for some time, before realizing that trading that elegance for worse performance was not worth it).
Here's [1] one example from the godfather of GA demonstrating how poorly GA performs
[1] https://webspace.science.uu.nl/~kreve101/asci/GAraytracer.pdf https://webspace.science.uu.nl/~kreve101/asci/GAraytracer.pd...
- deleted 5y ago[deleted]
- fanf2 5y agoI have done some experiments with type-directed static optimization of geometric algebra, but I didn’t get far enough to find out if it would scale up to real applications. The idea was to represent in the type system which components are known to be zero, so that (for instance) the GA representation of a vector or a rotation is the same size as it would be as a traditional matrix-based linear algebra. And the type system can check that the resulting of an operation is what you expect, eg, two planes intersect in a line. So, similar optimizations to gaigen, but (I hoped) more automatic and less runtime machinery. But as I said, I didn’t get it to work.
- fault1 5y agoi've played with some libraries recently in julia that followed this strategy; https://discourse.julialang.org/t/ann-cliffordalgebras-jl/71955/ https://discourse.julialang.org/t/ann-cliffordalgebras-jl/71... and I was surprised at how high dimensionality you could go. I'd like to see a c++20 version.
- ChrisLomont 5y ago>the same size as it would be as a traditional matrix-based linear algebra You can get it that small, it's all been done, but that's far larger than a quat, which can be stored in 3 components when normalized, and in 4 for quick and easy computation. For large models and more importantly scarce GPU memory, increasing model size results in less complex models and slower computation. There really is no benefit for 3D engines I can tell (and I was early on the GA bandwagon 20ish years ago... It just has not and I suspect will never pan out due to the inefficiencies not being worth it).
- wrnr 5y agoSomething like that exists in C++ and Rust: * https://www.jeremyong.com/klein/ https://www.jeremyong.com/klein/ * https://github.com/wrnrlr/g3 https://github.com/wrnrlr/g3
- gfxgirl 5y agoThese don't look like they'd be all that different in perf https://marctenbosch.com/quaternions/code.htm https://marctenbosch.com/quaternions/code.htm
- Mathnerd314 5y agoFrom the paper: > The main cause for the lower performance of GA is the Gaigen’s soft typing of the geometric algebra objects at compile-time: all types of objects (scalars, vectors, bivectors, trivectors, rotors and so on) are represented by a single data type in Gaigen. When a product or operation has to be computed, Gaigen first checks the grade usage of the argument(s) and then acts accordingly. This conditional step between function call and actual computation is largely responsible for the drop in performance. So, I blame the library. Writing out the 3-4 datatypes for 3D GA by hand as real types costs some development effort but should give equivalent performance.
- ChrisLomont 5y agoIt's been tried, over and over. It doesn't work simply because GA representations are larger. There's a reason that after decades GA hasn't replaced quaternions, and it's not because people don't know how to optimize code by hand.
- chombier 5y agoExactly, in fact I'm always surprised so many people still claim GA is better for practical implementations after all these years. My impression is that if you want something compact that you'll need to either give up on performance (type erasure) or separate compilation (track every type). GA is great for pen and paper proofs though.
- ChrisLomont 5y agoExactly - GA is nice for proofs, bad for code. I wrote an article in Games Programming Gems V back around 2004, showing many proofs of things one wants to do in computer graphics all derived simply using GA.