Subject: Re: tangent space for normal mapping
> Thank you! I'm very sorry, think that I changed newsgroup because I was a
> little proccupied to abuse of your help! If I knew you were here as well,
> I would have posted again in ogl (though this is less opengl related and
> more math related).
I did not mean to discourage you from posting. I anticipated
the games industry to be a great motivator for people to learn
a lot of math and computer science skills. The sad reality is
that it has not--an inordinate number of people seem to insist
they can handle everything thrown at them without having to
learn math/cs skills. My point was that if your inability to solve
your problem is rooted in lack of math skills, no amount of
struggling with the coding is going to help. You have to
accept the fact that there is some math background to be
learned. Bump/normal mapping is all about local coordinate frames
on a surface--an inherently mathematical topic. Confounding
the issue is that you really have a triangle mesh, so now there
are approximations to be made. If it is not clear what these
are or why they are made, that puts you at a disadvantage in
solving the problem.
> I really don't have the time to learn everything from scratch,...
Time is a scarce resource. You get to manage it however
you like. You make your decisions, you live by the consequences :)
> ...and I get different answers anytime I see a tut or post a
The Web has been a great source of information. It has also
been a great source of disinformation. What can you say when
it is trivial to post just about whatever folks want to post. It is
not just a matter of finding relevant information. You have to be
able to assess its quality and correctness.
> So I'm a bit confused. Now, what you describe is exactly what
> I've just implemented, but I wanted only to be sure I was doing it right.
> I have one more question: currently I average tangents and bitangents
> exactly as I do for normals. After that I orthonormalize. Is this wrong?
> Should I orthonormalize without averaging? Do the two differs?
The algorithm I mentioned is one approach. There is nothing
"wrong" with other approaches. In the end you want T, N, and
B at each mesh vertex. Your coordinate vectors might differ
from mine. As long as the normal-mapped results look realistic,
that's good enough :)
Now regarding your variation. Have you guarded against the
tangents averaging to zero (or nearly zero)? Your vertex normal
N is a normalized average of normals for the triangles sharing
that vertex. The normalized average of tangents will produce a
unit-length T. You have the same problem to deal with that I
mentioned: T is not guaranteed to be perpendicular to N. You
can project out the N component and renormalize. Once you
have T and N, there is no need to deal with averages of bitangents.
Just use B = Cross(T,N).
And a final "mathematical" thought. Your goal is to produce
a continuously varying unit-length tangent field T at the vertices
of the mesh. Imagine the vertices being so many and so dense
that the mesh looks like a smooth surface to you. If the surface
has the topology of a sphere, it is not possible to construct a
continuous tangent field of unit-length vectors. If you have
a continuous tangent vector field (no unit-length requirement)
on a sphere, there must be at least one point on the sphere where
a vector in the field must be zero.
> Sorry again, I've just implemented Shadow Mapping the last week and I
> tought that bump mapping would have been easier and not harder (2d bump
> mapping is so easy!)
Interesting. I found shadow mapping to be harder, mainly having
to fight OpenGL and Direct3D APIs (i.e. trying to figure out what
to call, in what order, how to create depth textures, etc.). It
was easier to implement with a software renderer, including writing
a sampler that easily handles the depth bias problems (graphics
hardware APIs appear not to expose hooks into how sampling is done).
View All Messages in comp.graphics.algorithms
tangent space for normal mapping =>Re: tangent space for normal mapping =>Re: tangent space for normal mapping =>
Re: tangent space for normal mapping
Copyright © 2006 WatermarkFactory.com. All Rights Reserved.