# How to Calculate tangent ?

Hello to all,

I try to understand the normal map

Problem, I try to calculate the tangent I have to send per vertex.

How to calculate it?

example with a triangle in front :

Position Normal Tangente
vertex 1 -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, ?, ? , ?,
vertex 2 -1.0f,-1.0f, 1.0f, 0.0f, 0.0f, 1.0f, ?, ? , ?,
vertex 3 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, ?, ? , ?,

I can just give you a short description what needs to be done:
What you need to do is to find a mapping from the space defined by the triangle into the space used by the normalmap-texture - or better said: the other way around.
From the texture-coordinates at the vertices and the vertices themselves you can derive where along the X- and Y-axes of the normalmap-texture-space go in the triangle-texture-space.

@PiouPiou: For the basics, check this* out. When you got the basic math right, check this out.

• Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001.

[QUOTE=thokra;1253212]@PiouPiou: For the basics, check this* out. When you got the basic math right, check this out.

• Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001.[/QUOTE]

thank you I will read the paper. I would say to you if I understood or not;-)

many thanks to all after my holliday it’ works