原帖地址
http://www.terathon.com/code/tangent.html
Q − P 0 = (u − u 0 )T + (v − v 0 )B ,
这行的意思是下面这个图
where T and B are tangent vectors aligned to the texture map, P 0 is the position of one of the vertices of the triangle, and (u 0 , v 0 ) are the texture coordinates at that vertex. The letter B stands for bitangent , but in many places it is stilled called binormal because of a mix-up in terms when tangent-space bump mapping first became widespread. (See “Bitangent versus Binormal” below.)
Suppose that we have a triangle whose vertex positions are given by the points P 0 , P 1 , and P 2 , and whose corresponding texture coordinates are given by (u 0 , v 0 ), (u 1 , v 1 ), and (u 2 , v 2 ). Our calculations can be made much simpler by working relative to the vertex P 0 , so we let
Q 1 = P 1 − P 0
Q 2 = P 2 − P 0
那么根据另外2点减去p0所得的向量
and
(s 1 , t 1 ) = (u 1 − u 0 , v 1 − v 0 )
(s 2 , t 2 ) = (u 2 − u 0 , v 2 − v 0 ).
We need to solve the following equations for T and B .
Q 1 = s 1 T + t 1 B
Q 2 = s 2 T + t 2 B
可以得出上面这个结论
由于Q1,Q2,s1,s2,t1,t2都是已知的 那么T,B 就可以求的出来 然后N = TXB
求出来的就是切线空间的左边
当normalmap是已知的时候,只要求逆就可以找到