Jump to content
  • Advertisement
Sign in to follow this  

Tangent and binormal

This topic is 3123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm attempting to implement normal mapping for the first time, with deferred shading... basically I calculate the normals for each fragment to fill the normal buffer with. I have a few questions about the tangent and binormal vectors... I'm pretty sure I understand what they are, they are essentially vectors representing the u and v components of the texture, right? So I was thinking the way to do this would be to store the normal, tangent, and binormal vectors with each vertex and pass them to the vertex shader, transform them, interpolate them using a texture coord and pass to the fragment shader. First... I know that to transform the normal you multiply by the inverse transpose of the model view matrix. But if the tangent and binormal vectors are parallel to the triangle face (they are, right?), you'd multiply them by the model view matrix (not the inverse transpose)? Second... this means 4 matrix multiplies and 3 normalizations per vertex, and 3 normalizations per fragment, which seems like a lot (I haven't done too much shader programming so I don't really know). And for skeletal animation, that'd be 4 matrix multiplies per vertex per weighted bone. Is there a more efficient way I should be going about doing this? Third... calculating tangents and binormals (oh joy). 3DS Max does not seem to do this for me. There are so many things I'm unsure of relating to this. First of all, what I'm currently doing to export objects is create a list of all vertices (3 per triangle), filling them with data (position, normal, texCoord), then going through and eliminating duplicates. This is working well, so ideally I'd like to do this for tangents and binormals too. However, I'm relying on the fact that 3DS Max will calculate the averaged vertex normals for me. I think I could figure out how to calculate the tangents/binormals for each triangle individually (ie, not averaged), but I'm not sure about averaging them, or even in what situations I should average them. For example, if the texture is mirrored, even if the normals were averaged on the seam, the tangent/binormal could not be. Any help would be greatly appreciated on any of these questions. EDIT: Looks like IGame exports tangents and binormals (bitangents?) from Max, so I'm covered there. Any idea on the other questions? Thanks. [Edited by - Gumgo on March 9, 2010 6:51:16 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!