Home Products Download Order Contacts

comp.graphics.algorithms

Subject: Re: tangent space for normal mapping



"halex2000" wrote in message
news:KdN8g.5959$b5.100193@twister2.libero.it...
>> 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...

What if one of the tangents is (1,0,0) and another (-1,0,0)?
This is an unlikely when you use texture coordinates as the
surface parameters, assuming the artist has arranged for the
texture image not to fold over on itself, but it is something
you might want to worry about. The source code I posted
earlier does check for degenerate behavior.

> Currently I'm using Gram-Schmidt to orthogonalize.

If you were to start with N in the Gram-Schmidt process, you
would project out the N component of T. Then you would'
project out the N and T components from B. This produces
the same results as my approach, except that I just compute
B as a cross product, not by projecting out components.

If you start with T and project out the T component of N,
then you probably will have different results. Gram-Schmidt
is dependent on the order in which you process the vectors.

> 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...

I build my coordinate frame in "object space"; I tend to call it
"model space". By implication, the normal and tangents are
in "object space". The use of the term "tangent space" regarding
shaders has been abused, just like folks use to say "binormal"
instead of "bitangent". (Note to CG folks: How many more
terms containing the words "space" or "map" are y'all going to
invent :)

You can build the coordinate frame in other spaces if those
are natural to the algorithm you are implementing. You can
pass matrix transformations as shader constants and apply
them as needed. My goal in writing vertex shaders is to minimize
the amount of transforming done by the program.

> 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?

Yes. The matrix is orthogonal since {T,B,N} is an orthonormal
set of vectors. Thus, its transpose is its inverse.

--
Dave Eberly
http://www.geometrictools.com



Reply


View All Messages in comp.graphics.algorithms

path:
tangent space for normal mapping =>Re: tangent space for normal mapping =>Re: tangent space for normal mapping =>Re: tangent space for normal mapping =>Re: tangent space for normal mapping =>

Replies:
Re: tangent space for normal mapping

Copyright 2006 WatermarkFactory.com. All Rights Reserved.