Sign in to follow this  

quick bump mapping question

Recommended Posts

zqueezy    122
i see a lot of different stuff on the net about bump mapping and especially the way the tangents and binormal vectors. my short question: is it really necessary to precalculate the binormal (and/or tangent)? or can i take some arbitrary vector (a) use that one with the normal to get a vector in tangent space (Cross(a,n)), and use the result to get the last vector? somewhere I read something about complications with that. But I cannot remember the argument but I remember that I didn't get it. I mean I'm pretty sure I can construct a matrix (TBN) to get the light vector in that space... thanx for answering zqueezy

Share this post

Link to post
Share on other sites
Madoc    146

You can derive the bitangent from the tangent and normal in the shader. I don't think there is any way you can get by without computing a tangent unless in very special cases.

Take a look at Eric Lengyel's code. In your shader, do B = (N cross T) * T.w or something like:

XPD bitangent, normal, tangent;
MUL bitangent, bitangent, tangent.w;

I believe there are no issues with this method. It works fine for me with some pretty jumbled UV mapping. In a recent post I claimed problems in trying to split the vertices where tangents were discontinuous but this is actually trivially solved, some of the data I was using in my splitting stage was corrupt/undefined!

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