Posts

VQM: a quaternion with a scale/shear matrix

The VQV transform holds a scale per axis, but it has no place for shear. A child that rotates under a parent with a non-uniform scale creates shear. Its product discards that shear, and its inverse cannot be represented in VQV form. The VQM transform fixes this with one change: it replaces the scale vector with a full 3x3 scale/shear matrix. The rotation stays in a quaternion, and the translation stays separate. The result forms a group, as an affine matrix does, and it interpolates, as a VQV does. Michael Aristidou and Xin Li describe it in The VQM-Group and its Applications, and I added it to Realtime Math 2.4 as vqmf and vqmd.

Read the full post

VQV and non-uniform scale

A VQS holds only a uniform scale. Artists want more: a scale per axis to squash and stretch a character, or to make a box longer along one axis. The VQV transform is thus: a quaternion, a translation, and a 3D scale. Two common examples are FTransform in Unreal Engine and UsdSkelAnimation in OpenUSD. UsdSkelAnimation stores each joint as a VQV, and it converts the transforms to matrices when it manipulates them. It works well enough, but it is not mathematically correct. It does not form a group, its product discards information, and its inverse is not a true inverse. This post explains why, and when it is safe to use.

Read the full post

VQ and VQS

In the previous post, we saw that an affine matrix mixes the rotation, scale, and shear in the same 9 values. It can drift, and it does not interpolate. The VQ and VQS transforms do the opposite: they keep each part separate, and they represent the rotation as a quaternion. As such, a VQ cannot hold a scale, and a VQS can hold only a uniform scale. Neither can represent shear. In this post, we look at how they work, and why that scale must be uniform.

Read the full post

Affine matrices

Affine matrices are the backbone of 3D virtual worlds. Every game engine, math library, and 3D piece of software includes support for them in one form or another. The primary reason for this is their flexibility: a single matrix can represent any combination of rotation, translation, scale, shear, and reflection. We combine them with a matrix product, and we undo them with the matrix inverse. However, that flexibility has a cost: one format cannot be optimal for each part, and it is difficult to separate the parts again.

Read the full post

Representing Affine Transforms: Table of Contents

Affine transforms are common in video games and other realtime applications. They can represent object rotations, translations, scale, and shear. These can also be mixed and combined in various ways (e.g. in a hierarchy of transforms). There are multiple ways to represent them and each format has its own strengths and drawbacks.

Read the full post