# Plz explain need for Tangent & Binormal Vectors

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Please explain to me the need for Tangent and Binormal vectors when computing BumpMapping in Pixel Shaders. Most tutorials I've seen just say "now we need the T&B vectors", and jump right into how to calculate them, never actually explaining their need in the tutorial's context. From what I've understood so far, the Tangent and BiNormal vectors are static to the Normal vector's position, and they point to the left, and upwards of the normal vector, correct? Also, if you guys know of a good book on this subject, just point it out and I might buy it. Thanks for any insight into this...

##### Share on other sites
From my (rather basic) knowledge a tangent vector is a vector tangent to the surface in the point. The Normal vector is a vector perpendicular to the surface at that point. The binormal vector is perpendicular both to the normal and tangent vector - use a cross product.

Basically I found it hard to understand how to create the tangent vector since there are infinite possibilities. I think you can just choose a random vector in the plane and then get the binormal by doing a cross product. However I'm not sure how the choice of the tangent affects the bump-mapping.

What i said is ok for a plane and not a curved surface but usually having polygons means we get to use their planes. I didn't really understand how it works when dealing with curved surfaces or paths.

##### Share on other sites
I had the same exact question when I was learning Graphics, all the tutorials had code but no explanations on the process.

The reason normal, tangent, and bitangent are needed are to be able to compute and create the bumps. Those 3 othonormal vectors (Assuming they are normalized) give you the reference frame of the point in the triangle being bump mapped, and the data is stored in the texture in that reference frame in most cases. Note that if they bump map is stored in object space you do not need the three vectors, but you cannot reuse the texture for other objects, do a search on object space bump mapping for details on this technique.

In summary:
The bump is in tangent space (Think of a height map), light, eye, halfspace, and other vectors are in world space. In order to complete the calculation you need to convert the light, eye, and halfspace vectors, etc into tangent space. To do so you use the 3 vectors that define the tangent space reference frame, and then you perform all the calculations on tangent space.

Some code to compute tangents:
http://www.terathon.com/code/tangent.html

Hope this helps.

##### Share on other sites
When doing bump mapping, your normals are stored in a texture. The texture is mapped onto a surface (on it's triangles). Thus, the normals in a normal map are in the reference space of that triangle.

When doing lighting, your vectors must all be in the same space or reference. Thus you convert the light vector to the same space that the normals are. How do you do that? With the normal, tangent and binormal.

Imagine that you encode the normal pointing up onto a texture. Now map it on the right side of a cube. If you read the value of the texture on that face of the cube, it will be point up. But the up vector is relative to the side of the cube where it is mapped (or the right vector). To put everything in the same reference, you use the normal, tangent and binormal to create an axis that does the job.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 13
• ### Forum Statistics

• Total Topics
632155
• Total Posts
3004473

×