# comp.graphics.algorithms

## Subject: Re: tangent space for normal mapping

Thank you again. I'm not really a beginner, I'm only a bit weak when math is
involved.

> Now regarding your variation. Have you guarded against the
> tangents averaging to zero (or nearly zero)?
Could that happen? Before averaging all the tangents are normalized...

> You
> can project out the N component and renormalize.
Currently I'm using Gram-Schmidt to orthogonalize.

> Once you have T and N, there is no need to deal with averages of
> bitangents.
> Just use B = Cross(T,N).
Yes, I know, but since the code is not much, I thought to calculate also the
bitangents. It would have made a bit easier to spot errors in the code.

I've have some problems in figuring out exactly what happens. For example,
we are talking about tangent space (normal maps normals are defined here),
but the normals on my mesh are defined in object space. I suppose that after
orthogonalization, also tangent and bitangent are defined here...
In addition, I was not able to find the answer to my question: when I build
the inverse of my TBN matrix, can I just transpose it?
Thank you again.
By the way, I've found even raytracing math easier than this one. I suppose
that this is due to the fact that the algebra exam was my nightmare because
I wasn't able to pass it :-(