[XNA] [HLSL] Tangents and Binormals

Started by
3 comments, last by jischneider 12 years, 8 months ago
I currently have vertices with position, texture coordinate and normal data. How do I determine the tangent and binormal data for each vertex?
Some easy to read C# code would be very helpful.
Thanks!
Advertisement
This link has a good explanation of how to compute the TBN matrix. It has C++ code, but it can easily be converted to C#.

http://www.terathon.com/code/tangent.html
Ok thanks for that link.... I got it working with some experimenting. The math is kinda hard for me.
You can create a new vertex element array and clone your mesh with the new format.
Your vertices are real time created? or can be created with a DCC tool? Because the XNA content pipeline calculates automatically the models' tangents if the developer wants it.

If not, maybe (but I doubt it) the XNA team has the tangent method accessor set to public.

[size=1]Project page: [size=1]<

[size=1] XNA FINAL Engine[size=1] [size=1]>

This topic is closed to new replies.

Advertisement