Quesion on TBN Matrix generation

Started by
1 comment, last by Syntac_ 7 years, 1 month ago

hi math experts, 

i have a question and i need deep understanding of normal map TBN matrix generation formula.

I see from lots of tutorials such as in learnopengl.com or in ogldev

https://learnopengl.com/#!Advanced-Lighting/Normal-Mapping

http://ogldev.atspace.co.uk/www/tutorial26/tutorial26.html

that the formula goes something like this.

 

E1=ΔU1T+ΔV1B

E2=ΔU2T+ΔV2B

U1, U2, V1, V2 are texture coordinates

T and B are Tangent and Bitangent vectors

>>

But i just dont understand how the above formula was created and why is the formula like that?

I understand we need to get two vectors that is why the difference of U and V vectors are computed to form a vector, 

but i dont understand why it needs to be dot products to T and added to difference of V vectors and dot product to B.

in summary, i dont fully understand the formula itself.. 

I need elementary explanation please :(

Advertisement

E1=ΔU1T+ΔV1B

E2=ΔU2T+ΔV2B

These formulas are a different way to represent the edges E1 and E2 using the tangent and bitangent as the article says.

 

In order to calculate the tangents and bitangents per vertex you need to apply the last formula in the article.

There are several methods to calculate the tangents and bitangents for a mesh, the most popular one I know of is "MikkTSpace".

https://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/mikktspace/mikktspace.h

https://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/mikktspace/mikktspace.c

 

The TBN matrix that you construct in the shader is made up of the tangent, binormal and normal vectors. As these are all orthogonal unit vectors they create an orthonormal basis.

This topic is closed to new replies.

Advertisement