# Tangent Calculations for normal mapping(Terathon software tutorial)

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

## Recommended Posts

Hi, i have looked at an tutorial at Terathon software which describe and implements a tangent vektor calculations. I also read this tutorial which describe how to get a normal from a normalmap. Anyway in the second tutorial they calculate the binormal by "the cross product of the tangent and the normal" which sounds fine to me. But in the Terathon software tutorial they also save a "handedness" component in the tangent vector(which is a 4 component vector) and i wonder what is that component for?

##### Share on other sites
Well, becouse sometimes you may not want the binormal to face in the direction the cross product gives you, but in the opposite :) So then you multiply the result of the cross product with the 4 component (1 or -1) to keep it the same or flip directions. This has to be there, becouse sometimes the UVs of the model are such that the cross product gives the result you dont want. Imagine this: two quads, sharing an edge with the according UVs at the vertexes.
---------------------------------|(0;0)     (1;0)|          (0;0)||               |               || ---------->   |   <--------   || |             |           |   || |             |           |   || |             |           |   || |             |           |   || ^             |           ^   ||               |               ||(0;1)     (1;1)|          (0;1)|---------------------------------

Now, the normals of these quads should point out of the screen. The horizontal arrows indicate the tangent vectors of both faces. The vertical - the correct binormals or bitangents, as some call them. Now, if you just took the cross products of the normal & the tangent for both faces, one of them would be pointing in the right direction, but the other in the opposite, becouse the normals are the same, but the tangents opposite. Look into a further description of the cross product, if you dont understand why this happens. Thats why you need to set the 4 normal or tangent, depends on where you want to store it, component to -1 for those binormals that need inverting, and to 1 for those that dont.

I hope I make sense :P

##### Share on other sites
If the artist uses texture mirroring ( ie storing half of a character's face ), then you will have several mesh triangles with the same uv triangle, only flipped upside down in uv space.

This handedness factor can adjust for that.

1. 1
2. 2
JoeJ
18
3. 3
4. 4
frob
12
5. 5

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

• Total Topics
632188
• Total Posts
3004650

×