Is Binormal vector a cross product of normalized tangent vector and normalized normal vector or vice versa?
Binormal_vector = cross(normalize(tangent_vector), normalize(normal_vector))or
Binormal_vector = cross(normalize(normal_vector), normalize(tangent_vector))Many resources like this () define Binormal vector as
B = T X NBut in most of the shader codes Binormal vector is defined as
Binormal_vector = cross(normalize(normal_vector), normalize(tangent_vector)) * handedness i.e.
B = N X T 1 Answer
In an Right-Handed Coordinate System (see further Right-hand rule)
the Binormal Vector is calcualted by:
B = N x Twhile in an Left-Handed Coordinate System
the Binormal Vector is calcualted by:
B = T x N
In OpenGL is commonly used a Right-Handed Coordinate System, but this depends on the specification and definitions which are chosen by the user.
Further if a system is mirrored it changes from one system to the other. This may occur if a texture is mirrored or looked at from the backface.
Note in your above code this is compensated by handedness, which is the "sign" of the binormal vector and either 1.0 or -1.0.
Binormal_vector = cross(normalize(normal_vector), normalize(tangent_vector)) * handedness 0