# Why does blender output vec4 tangents for GLTF?

I've been trying to integrate both GLTF 2.0 and blender into my asset pipeline for my custom renderer. I noticed some strange normal artifacts when normal mapping. So I go to look at my tinygltf code, low and behold for some reason the tangent vector from my blender export is a vec4 array instead of a vec3... Once I account for this, my normal mapping is fixed, and rendering looks correct.

What is going on? Is that extra value actually needed? Why does blender output vec4, and not vec3 for tangents, but vec3 for normals?

• tangent.w is the bitangent sign. You use it compute the bitangent with bitangent = cross(normal, tangent.xyz) * tangent.w. See the spec. Apr 26 '21 at 19:34
• @scurest Okay, that makes sense, I thought that would be static and program defined, I guess GLTF does this for maximum compatibilities sake. Apr 26 '21 at 19:40
• Agreed with scurest. I'll add that tangent.w is specified to only ever be 1.0 or -1.0. It's needed when the UV winding order is flipped. If you ignore it, some geometry (especially mirrored geometry) might appear with the normal map flipped inside out. Apr 26 '21 at 19:47