Rotation from TBN frame

Say that i have two 3d vectors. They are not colinear, and they both have a length larger than 0.

I will use these two vectors to construct 3 orthogonal vectors - tangent, normal and binormal.

Is this enough for me to achieve any rotation and is there a better method to achieve this? I don’t think i ever understood why the rotation matrix is always expected to be a Matrix4 in some of these methods and there arent many Matrix3 methods .

        rm.set(
          ...[tangent.x, binormal.x, normal.x, 0],
          ...[tangent.y, binormal.y, normal.y, 0],
          ...[tangent.z, binormal.z, normal.z, 0],
          ...[0, 0, 0, 1]
        );

Yeah that works. I construct matrices by hand like that sometimes… but often there is a higher level construct that is more readable.
I think there aren’t many 3x3 matrix fns, because there are enough helper methods on Matrix4 to do what you need with the 3x3… like

.compose/.decompose
.extractBasis (gets your 3 vectors out)
.makeBasis (does what your code ^ does)
etc.

2 Likes