Original Post
I'm trying to implement tangent-space bump-mapping, which is graphics-related, but I'm going to post my questions here, since they have more to do with math. After reading a couple of articles on the subject, I have arrived at the conclusion that they don't make any of sense to me at all, which is making me REALLY nervous. So we have three points. They have the coordinates (x0, y0, z0), (x1, y1, z1), (x2, y2, z2) in world-space, and (u0, v0, 0), (u1, v1, 0), (u2, v2, 0) in "tangent space". Given the world coordinates of a fourth point, I need to find its corresponding coordinates in the tangent space. The articles talk about finding two vectors in world-space with the directions in which the u and v coordinates increase, and call those the tangent and bi-tangent (T, B). Then, they build this matrix: |Tx Ty Tz| |Bx By Bz| |Nx Ny Nz| (Where N is normal to the triangle formed by our three points.) They then say that multiplying a point in tangent space by this matrix will transform it into world space. Well, surely, it would transform it into SOME other space, but why this space would be exactly world space is beyond me. Let alone the fact that I don't get the derivations of T and B, I wouldn't know how to use them correctly even if I had them given. First of all, the articles all seem to solve the problem backwards. Why not build a matrix to transform from world to tangent space in the first place? What difference could there possibly be in the operations that need to be taken? Second, isn't multiplying a 3D vector V by the above matrix the same as taking the dot-products between V and T, B, N? But this would give us a point relative to the origin of T, B, N in world space. No one seems to tell how to find this origin, though and I don't see why it should be (0, 0, 0). They all seem to imply that T, B, N are normalized and normal to each other. I don't see no reason for any of that to be true. Am I going crazy here? Clarifications highly appreciated!