Live data from Hacker News

Quaternions

liorsinai.github.io

11–20 of 118 posts

Re: Quaternions

#11
post #4

I've been out of the games sphere for a long time, but is slerp() really the default idiomatic interpolation approach in modern games nowadays? There are a vanishingly small number of scenarios where lerp() + normalize() doesn't work perfectly well enough and it is drastically faster and SIMD-friendly. That used to be the case at least.

as for why lerp+normalize isn't enough: it all depends on the distance between things being blended, no? With far away end points, the apparent speed of the rotation would be fast, slow, fast, at the beginning, middle, end, which could be a bummer.

Re: Quaternions

#12
post #5

3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: https://youtu.be/d4EgbgTm0Bg . Here’s a Math SE answer on why: https://math.stackexchange.com/questions/1784166/why-are-the... , here’s a more ELI5 discussion: https://www.reddit.com/r/math/comments/9urjyx/why_there_is_n... . I especially like this very intuitive comment in that thread : https://www.redd…

[deleted]

Re: Quaternions

#13
David Eberly has written a huge amount of great and free intro mathematical papers. The "Mathematics/Algebra" section of [1] has a few things on quaternions, including a nice self-contained linear algebra-based derivation of why it makes sense to represent a rotation with four numbers, which ends up being a sneaky introduction to quaternions [2]

[1] https://www.geometrictools.com/Documentation/Documentation.h...

[2] https://www.geometrictools.com/Documentation/LinearAlgebraic...

Re: Quaternions

#14
post #5

3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: https://youtu.be/d4EgbgTm0Bg . Here’s a Math SE answer on why: https://math.stackexchange.com/questions/1784166/why-are-the... , here’s a more ELI5 discussion: https://www.reddit.com/r/math/comments/9urjyx/why_there_is_n... . I especially like this very intuitive comment in that thread : https://www.redd…

> prove that no such n-tuples exist for n>4.

It depends on how you define "such" n-tuples. The octonions (n = 8) aren't associative, but they have all the other relevant properties.

Re: Quaternions

#15
post #4

I've been out of the games sphere for a long time, but is slerp() really the default idiomatic interpolation approach in modern games nowadays? There are a vanishingly small number of scenarios where lerp() + normalize() doesn't work perfectly well enough and it is drastically faster and SIMD-friendly. That used to be the case at least.

as for why lerp+normalize isn't enough: it all depends on the distance between things being blended, no? With far away end points, the apparent speed of the rotation would be fast, slow, fast, at the beginning, middle, end, which could be a bummer.

The two aspects that slerp() addresses over lerp() + normalize() are 1) it can deal with pole-to-pole interpolation 2) It always takes the shortest path.

In practice, the former is often provably never going to happen, and the later doesn't actually matter from a qualitative standpoint: Quaternion interpolation will always look a bit weird over large angles, especially if there's a roll component to one of the orientations.

As far as having a constant interpolation speed: again, this is rarely perceptible, and truly linear transitions from one orientation to another looks janky so some amount of filtering happens anyways (an ease-in-ease-out for example).

But yeah, for very large interpolations, it can create a slight authoring/runtime skew. My rule of thumb used to be: use slerp() when the orientations can be at least 120 degrees apart, or when lerp() yields weird results. However, it's really rare to be interpolating over such a large orientation change, you almost always have a few keyframes or dead-reckoning syncs in between.

Again: This might be an outdated perspective though.

Re: Quaternions

#16
post #4

I've been out of the games sphere for a long time, but is slerp() really the default idiomatic interpolation approach in modern games nowadays? There are a vanishingly small number of scenarios where lerp() + normalize() doesn't work perfectly well enough and it is drastically faster and SIMD-friendly. That used to be the case at least.

You can see what's wrong with that approach by considering the difference between traveling at constant speed along the arc of a circle versus traveling at constant speed along a chord, and projecting the point (out from the center) onto the arc.

It works great if the chord is far away from the center (and also the angle is less than a half turn). If the chord goes through the center, it doesn't work at all.

Re: Quaternions

#18
post #5

3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: https://youtu.be/d4EgbgTm0Bg . Here’s a Math SE answer on why: https://math.stackexchange.com/questions/1784166/why-are-the... , here’s a more ELI5 discussion: https://www.reddit.com/r/math/comments/9urjyx/why_there_is_n... . I especially like this very intuitive comment in that thread : https://www.redd…

This comment is about ℂ the set of complex numbers, not the progamming language. It left me confused for a moment.

Re: Quaternions

#19
post #14
post #5

3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: https://youtu.be/d4EgbgTm0Bg . Here’s a Math SE answer on why: https://math.stackexchange.com/questions/1784166/why-are-the... , here’s a more ELI5 discussion: https://www.reddit.com/r/math/comments/9urjyx/why_there_is_n... . I especially like this very intuitive comment in that thread : https://www.redd…

> prove that no such n-tuples exist for n>4. It depends on how you define "such" n-tuples. The octonions (n = 8) aren't associative, but they have all the other relevant properties.

You’re absolutely right, forgot to mention associativity: https://en.m.wikipedia.org/wiki/Frobenius_theorem_(real_divi...
Post reply on HN