HNHacker News
TopNewBestAskShowJobs

ninepoints

880 karma · joined August 7, 2019

submissionscomments
ninepoints··on Basic skeletal animation with geometric algebra
Thanks for the questions. Indeed many animation libraries store the quaternion and translation as separate components. There are a few reasons I use dual-quaternions in my own code. First, because I can "slerp" them, this means that when I compress keyframes, and can perform better quality fits (potentially less error and fewer keyframes needed). The dual-quaternion has uses in skinning which I'm sure you're aware of, but if the base transformation is a dual quaternion, I can more efficiently morph neighboring vertices as well (I've ported the dual-quaternion application to shader code as well). One optimization that GA makes clear is the ability to factor out terms when applying a dual quaternion to a number of entities all at once which makes it almost as efficient as a quat-translation while conserving energy as well.

Finally, the dual-quat representation is beneficial when modeling kinematic motion specifically (not necessarily artist-authored) which can be useful in contexts beyond games (e.g. robotics, deep-learning, computer vision), but also inverse kinematics (which unfortunately I haven't had time to write about yet)

ninepoints··on Basic skeletal animation with geometric algebra
Yup, now that I've "swallowed the red pill" so to speak, I can't even look at quats/dual-quats in the same way. They are very much a small cross-section of something much bigger (more expressive/powerful/etc).
ninepoints··on Basic skeletal animation with geometric algebra
Yup that's a good suggestion. I actually don't even need to compile to wasm for much of it (I have it partially ported to GLSL already)
ninepoints··on Basic skeletal animation with geometric algebra
Thanks for the feedback. You may find https://www.jeremyong.com/klein/geometry-potpourri/ more approachable but I admit I don't have finalized material I'm completely satisfied with showing yet :(

The math is definitely more easy to grok if you've seen/used Lie Algebra/Group formalisms before so that's another shortcoming, but the main thing GA gives us here is a "dual-quaternion slerp" which I literally could not find an implementation of anywhere! The formula for a quaternion slerp is actually not too hard to derive, but a dual-quaternion slerp is far more difficult. Part of the point of the post was that this was somewhat surprising to me (both that GA makes it approachable, and that dual-quaternion slerp implementations didn't exist in the wild).

ninepoints··on Basic skeletal animation with geometric algebra
Thanks for the questions.

> re: introductory materials

The 3 links I compiled here (https://www.jeremyong.com/klein/references/) I consider an absolute must for starting to consume GA. The book (ref #3) has one chapter undergoing revision regarding the usefulness of the degenerate metric for modeling projective geometry. My understanding is the chapter will be released for free once finished. From this alone, I was able to piece together enough to write one working implementation of GA that I was able to use to verify the computations and my understanding. Klein is my third GA library which I wrote once I was pretty sure I was comfortable with the formalism. Another great set of resources is anything posted on bivector.net.

> re: question 2

The elegance of the math does help me identify better optimizations in a number of cases, but in other cases, it makes a whole series of operations well-defined (for which there was no good analog before). I posted some examples in another comment, but essentially, quats and dual-quats generally only work on points, and in a somewhat awkward manner. I can't easily compose 2 rotations, a translation, a dual quat, and a quat, and then expect it to work on a line for example. In GA, this is ... completely trivial. And because it all fits nicely in the framework, all the above benefits from the same SIMD optimizations.

I believe the reason GA was not considered well-suited for production/perf reasons is twofold. First, prior art focused on GA with arbitrary dimensionality/metric (results in either increased compilation time, or reduced performance). Second, there wasn't much overlap between practicitioners of GA, and graphics/animation engineers on the other side. I view Klein as "low-hanging fruit" in that sense, and consider myself fortunate to have come across the theory in the manner I did. I had written it off as just "an easier to understand Quaternion," but once I realized how much I (and perhaps some of my colleagues) were missing, I opted to actually try and productionize GA to "fill the gap" so to speak.

(FYI tried to send this over an hour ago but HN keeps rate limiting me :( )

ninepoints··on Basic skeletal animation with geometric algebra
Yes actually :)

It took me a long time to actually decide to invest in GA because the sentiment I had was "it just replaces what I already know" and what I knew at the time was matrices, quaternions, and dual quaternions.

It turns out, I was pretty wrong in that respect. For example, in the current predominant formulism, it's awkward to rotate a line with a quaternion, then identify the dual quaternion that maps that line to yet another line, then apply that dual quaternion to a point. In GA, this just works (mind exploding gif). Or, I can construct a line between two points, then find the quaternion that maps a different line to that one, and convert it to a matrix to do "look at" transforms in a shader. Also just works.

I think the more I use GA, the more elegant I find it, and it takes me well past the formulism I used to know (which is still useful from time to time, but far less expressive). While I could provide helpers for all the common operations, the operators in GA will always have their use because... there's just so much you can do with it. At some point, the library will just because unwieldy/large. I haven't necessarily found the sweet spot yet for size/convenience, but I hope to converge there over time. Provide enough to be usable for most people, while at the same time being a launchpad for learning more about the abstraction itself.

From an implementation point of view, I've found a number of optimizations that were made easier (or even possible) with GA that I hadn't identified despite working with quaternions for years before.

ninepoints··on Basic skeletal animation with geometric algebra
Working on them! That said though, the audience of this article was originally meant to be animation engineers that have already "earned some stripes" and wanted to see the GA formulation.
ninepoints··on Basic skeletal animation with geometric algebra
I'm the author of Klein and was surprised to see a sudden burst of traffic so I checked the usual suspects and ended up here :)

My goals for authoring Klein was to provide a library for performing all manner of geometric operations using the language of Geometric Algebra. The benefits are that the formulism is exception-free (meaning, for example, parallel planes have a well-defined line of intersection, that projections to higher/lower grade entities make sense, etc), and works equally well on points, lines, and planes. Practitioners coming from robotics/animation will also find the entirety of the Lie algebra/group inside GA as well for smooth interpolation, etc.

As a graphics engineer, I found most libraries out there unsuitable because of performance reasons. We're used to having nicely packed SIMD optimized quaternions for example. Klein fills this gap and (hopefully) in a manner where you can use it even if you don't understand the Geometric Algebra (yet!). Over time, I'd like to round out the documentation to explain the underlying theory, which I find unreasonably elegant and has shifted my thinking in the last few years.

Let me know if you have any questions about Klein or geometric algebra!

ninepoints··on Basic skeletal animation with geometric algebra
Original author here, it is absolutely my goal that the library should be usable without needing to understand the ins and outs of GA. To this end, I've started adding a bunch of "helper" functions that do tasks like projecting a point onto a plane, or identifying the line through a pointer parallel to another line, etc.

I've been (slowly) working on additional documentation in the meantime and didn't expect to see the animation article hit the frontpage :). That said, in the meantime, there is a GREAT cheatsheet for all the relevant formulae here: https://bivector.net/tools.html (scroll down to the bottom). You can get the PDF version here: https://bivector.net/3DPGA.pdf

← PreviousPage 8 of 8