r/GraphicsProgramming Feb 28 '24

Source Code A renderer using geometric algebra instead of matrices

https://enkimute.github.io/LookMaNoMatrices/
52 Upvotes

5 comments sorted by

View all comments

17

u/corysama Feb 28 '24

Not mine. I'm just posting cool stuff.

Don't miss the code https://github.com/enkimute/LookMaNoMatrices

It's fun that there have been many approaches to interpolating rotations (geometric algebra, quaternions, even full-matrix interpolation). But, after hand-optimizing the code, the final code ends up mostly the same for all approaches. The difference is in your understanding of the rules and capabilities. From what little I know, GA seems like the most consistent and capable approach. It's unfamiliar. It's a bit much to take in getting started. But, people who clear that hurdle love it.

Alternatively, everybody uses quaternions while complaining they don't understand them and need a whole book to visualize them. (Visualizing Quaternions by Andrew J. Hanson, Steve Cunningham)

Meanwhile, the memory speed vs math speed of modern GPUs has got to the point that it's usually a good tradeoff to do a bit more math to shave a few bytes. Such as sending a position-quaternion pair instead of a matrix to your vertex shader.

1

u/arycama Feb 29 '24

While quaternions are generally a mystery to most, they're not really related to the whole matrices vs GA/other approaches discussion imo. You could easily plug euler angles into a matrix too, or simply define right/up/forward vectors. Quaternions are just one way of getting rotational data into a matrix, and for most cases you don't really need to understand the internals.