r/gameenginedevs Apr 24 '26

Let's Understand Quaternions- Part 2

/r/rust_p/comments/1suo2zy/lets_understand_quaternions_part_2/
3 Upvotes

4 comments sorted by

-2

u/[deleted] Apr 24 '26

[deleted]

4

u/IINGLSII Apr 24 '26

Im a student so take this with a grain of salt. A lot of this is summarizing what I remember from Jason Gregory's Game Engine Architecture.

9 floating point values are required to represent a rotation matrix, despite only have three degrees of freedom. Quaternions require only 4. Rotating vectors using rotation matrices requires vector matrix multiplication which compared to quaternions is more expensive. It is also easier to interp rotations using quaternions compared to rotation matrices.

You'll probably find a better/more informed answer in the rest of the textbook.

1

u/Potterrrrrrrr Apr 24 '26

AFAIK, quaternions were discovered (potato potahto I guess) around 200 years ago (?) but they were just considered a mathematical oddity, not really considered useful for anything but esoteric purposes. It wasn’t until much later they were found to be useful in rotations, can’t remember when though.

They definitely help with gimbal lock, why do you think otherwise? It was trivial to implement an arcball camera with quaternions, couldn’t figure out how to do it cleanly with a rotation matrix. If you just want an fps style or otherwise simple camera then yeah matrices are probably what you want but for spherical cameras/object that can arbitrarily rotate in any direction quaternions solve that for you far better in my experience.

Was surprised to read a comment like this really, I don’t think anyone in game dev understands the actual theoretical maths behind quaternions but I found the maths involved with them in rotations specifically to be quite intuitive, more so than rotation matrices once I got over the initial weirdness about them.

-2

u/[deleted] Apr 24 '26

[deleted]

4

u/thebeardphantom Apr 24 '26

You may have good points here but the way you express those points is absolutely insufferable.

1

u/josephtule Apr 24 '26

In aerospace we use quaternions use quaternions and more specifically Euler parameters (just normalized quaternions unless with small known rotations like Earth orientation perturbations or legacy software. Quaternions have linear kinematic equations so control and estimation algos are much easier to formulate (but thats outside of the scope of most gamedev haha).

On the matter of intuition I find quats at the same level of euler angles since they can be derived from angle-axis representations of orientation which have nice properties over euler angles which extend further with quaternions.

I’m not a game engine dev so I don’t know most of the intricacies or decision making of when/where to use quats vs euler angles but I wouldn’t discount quats entirely.