• Advertisement
Sign in to follow this  

Quesion on TBN Matrix generation

Recommended Posts

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 :(

Edited by cebugdev

Share this post


Link to post
Share on other sites
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.

Edited by Syntac_

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement