Tangent space

Is there a matrix to get the tangent space ? and if i should build it… how do i do it ?

.ORG

Look at UnityCG.cginc file (in Unity.app/Contents/CGIncludes). It contains a helper macro named TANGENT_SPACE_ROTATION that builds a 3x3 matrix from vertex normal and tangent.

In Unity vertices supply normals (float3) and tangents (float4; xyz is the tangent vector and w is either +1 or -1; to determine the direction of binormal). Binormal is the cross product of normal and tangent, multiplied by tangent.w. The tangent matrix then is tangent, binormal and normal vectors as the axes.