Original Post
I've been pounding my head against the keyboard for quite some time now over this issues. What I have is a Doom 3 model standing in its "modellers default pose" with its arms outstretched, no animations. I performed the skinning in software. Now, all I'm trying to do is light the mesh with the tangent space normal map correctly before moving into vertex shaded skinning. However, I cannot, for the life of my get the normal map to look right. I have an object space normal mapping system working currently and I'm attempting to port that over to a tangent space normal map. I've researched this extensively however I don't ever really find information that matches other peoples info or I don't find enough information. What my question is is this: I have a function to calculate the tangent, biNormal and normal vectors from 3 vertices and 3 texture vertices. Now, if I invert this matrix and use the normal in my "NORMAL" parameter to my shader, most of the polygons do not render. If I do not invert it, then what I'm passing into the shader is the TBN matrix. Does this matrix convert texture space to object space? Then, does the TBN Inverse matrix convert object to texture space? Please let me know if this is correct. Secondly, if I DO have to pre-calculate the inverse matrix and pass in the tangent and normal's, how do I get OpenGL to render the vertex regardless of the normal being in texture space (because it would drop the vertex out thinking its backwards wouldn't it??)? Is the normal being in texture space actually causing any problems in this manner? The biggest question then is what am I SUPPOSED to pass into the vertex shader, the TBN matrix or the TBN Inverse matrix? Whichever one, what am I supposed to do with it? If its the inverse, do I transform the light vector AND the view vector or just the light vector?? If its the TBN, do I transform the normal read from the normal map? Another question, if anyone knows it. I'm trying to do smooth shading. So far I have NO idea weather or not its valid to assume that I can add together all the normals and tangents and then normalize them at the end so each vertex has a smooth shaded vertex normal and tangent. Is this valid or does EACH tangent have to be unique to a given vertex? If so, how would you go about tri-stripping and rendering those?? If I CAN add them all together and normalize them in the end, please let me know. If I can't, how do you perform smooth shading then? I hope someone has an answer to more of these than fewer, but honestly, anything helps right now. Please ask if you have questions or E-mail me and I'll answer them as soon as I can. Thank you for your time and I hope someone out there can help me! Thanks! :)