top of page
Writer's pictureJoaquin De Losada

Talk Title: A visual guide to Quaternions and Dual Quaternions Part 2

Effective talk: Visual guide to Quaternions Part 2

Year of Talk: 2023



Writers Note: I initially intended for this blog to be posted last week but I got super busy packing and needing to move from where I was living in Austin to Peru which ate into the time I wanted to spend with this video. I plan on returning to the normally scheduled blogs moving forward. 


I also recommend reading the last blog on the visual guide to Quaternions Part 1 for extra context. Unlike the previous part, it was harder to properly visualize much of the material for the second part of the talk. If possible I would recommend watching it on YouTube to understand better.


The main purpose of Dual quaternions is to use a similar movement to normal Quaternions but affect both the rotation AND transformation of an object. While normally Quaternions have only four variables controlling their rotation, dual quaternions will have 8 total variables to control rotation and transformation. Those being; {W = 0; yz = 0; zx = 0; xy = 0; dx = 0; dy = 0; dz = 0; dxyz = 0}.


The way Quaternion gets translated to Dual Quaternion is as follows. The w variable represents the same set of information in both Quaternions, meanwhile, the other three variables in the regular Quaternion transition to the 6 main variables seen in the dual Quaternion which represents the commonality between all the variables. Instead of the like passing through the object origen it can now be placed in any location necessary. The variables yz, zx, and xy represent the missing variables from the Quaternion numbers. This is because each variable represents the rotation of an object from one variable to another on a third axis. As an example, when an object is rotating from the y to z-axis (yz in dual Quaternion) it is rotating around the x-axis as seen in normal Quaternion. This logic occurs again with both the zx and xy variables. While the variables starting with d represent an object transformation on any of the planes.


Unifying rotation and translation:

There are two main ways of unifying both features for dual Quaternions. Either through 4 by 4 Matrix or through doing composition (Multiplication) of two dual Quaternions. But according to the presenter it is easier to calculate using Quaternion composition to find the outcome as it helps simplify the movement. An example of this is when you want to invert an object you can simply multiply the quaternion by -1 to have it switch. Another advantage is that during Quaternion calculations it allows you to interact with points, lines, normals, and planes while 4 by 4 matrices can only properly affect a single point.


At the same time working with 4 by 4 matrixes can cause meshes to react weirdly when rotation is applied to bones they are attached to. Quaternions meanwhile allow for an easier time to do those calculations without having as much of an effect on any mesh that's attached. Many 3d modeling software currently allows for dual quaternions to be used to keep meshes in better shape.


A way of understanding how the values relate to each other is either when rotation in both quaternions is the same but the transformation is different or when rotation and transformation for the quaternions are different. Movement for an object between two Dual Quaternions that have the same rotation values but different transformation values will cause a lerp movement between both. But if there is movement from two Dual Quaternions that have different rotation and transformation will cause an object to rotate around a common focal point. Where the focal point occurs at a distance concerning the difference of the rotation values. In other words when an object has two different rotation values that are close to each other then they will have the focal point in which the object rotates around farther away from said object. Meanwhile, a large difference in the rotation change will cause the object to rotate around a closer focal point.


Finally, to explain the final variable (dxyz), it is meant to help smooth the relationship between both the rotation and transformation movement when occurring at the same time. It is a similar thing to when a screw is both rotating and moving in one direction when being screwed.


This means that besides the dxyz variable that was just explained and the W variable which represents the identity of the object. The yz, zx, xy is the line that goes through the origin of the object affecting how it rotates, and dx, dy, dz is a line that appears in infinity which affects how an object moves around.


The problem with (S)LERP:

Lerp (And Slerp) allows for an object to easily rotate or transition between two given values. A big challenge with it is the fact that it can have inconsistent timings when doing said movement.


A solution to have smoother values is through either using exponential (Exp) or logarithmic (Log) math. Using either will allow for an easier time smoothing the values out. Exponential was used when transforming axis values to quaternion values while logarithmic can be used to turn a quaternion to axis values.


When you use the same Exp and Log idea for Dual Quaternions it allows you to similarly acquire different information. Doing the Log on the rotation of a Dual Quaternion will return the rotation axis (With some angle/2 value) while the Log on the translation returns the translation axis (With some distance/2 value). Finally, if the log is calculated on both motions at the same time it will return a sum of both the previous values (angle/2 + distance/2).


This equates to two equations that allow for smoother bones to rotate while making sure the mesh doesn't cause as many warping effects. The first one is by multiplying all the weights by the rotations of a vertex and then adding it all together for a single vertex. Drastically decreasing warping effects but not eliminating them.





Meanwhile, if you instead multiply each weight by the logarithmic of the end rotation which is being divided by the initial rotation, and add it together to then put it to the exponential value times the initial rotation will allow for no significant warping of the mesh.




7 views0 comments

Recent Posts

See All

Comments


bottom of page