Building an Orthonormal Basis, Revisited

Tom Duff, James Burgess, Per Christensen, Christophe Hery, Andrew Kensler, Max Liani, Ryusuke Villemin

Abstract:

Frisvad [2012b] describes a widely-used computational method for augmenting a given single unit vector with two other vectors to produce an orthonormal frame in three dimensions, a useful operation for any physically based renderer. The implementation has a precision problem: as the z component of the input vector approaches -1, floating point cancellation causes the frame to lose all precision. This paper introduces a solution to the precision problem and shows how to implement the resulting function in C++ with performance comparable to the original.

Paper (PDF)