Jump to content
  • Advertisement
Sign in to follow this  
Maddius

Compute Tangent

This topic is 3330 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

Hi all, If you loaded say an .x file or had any kind of geometry, how would you calculate the tangent vector at each vertex? I would like to be able to load a .x file in and then generate its tangents, or does the .x file store tangents if told too? If so how do you extract them? Thanks all.

Share this post


Link to post
Share on other sites
Advertisement
If you're using D3D9 then you can use D3DXComputeTangentFrameEx to generate tangents and binormals. I'm not sure if .X files can store tangents and binormals.

Unfortunately the DX10 version of D3DX doesn't have any equivalent. It is possible to create temporary D3D9 device and then create an ID3DXMesh so that you can generate the tangent frame, but it's a bit of work. Otherwise you're stuck with rolling your own functions, or using something third-party like NVMeshMender.

Share this post


Link to post
Share on other sites
Okay I am using Dx10, so how easy to use is NVMeshMender? Do you just supply the mesh data and it will return the tangents? Anybody used it before?

Share this post


Link to post
Share on other sites
I used it a long time ago...basically you just need to get your vertex data into into its library-specific structure and then you just call a function. I don't think it took me more than a few hours to get going.

Share this post


Link to post
Share on other sites
You can also calculate tangent vectors on your own it's not that difficult (I'm doing that way). Here is good article how to do that: http://www.terathon.com/code/tangent.html.

Share this post


Link to post
Share on other sites
Okay thats all fair enough, I have read that article before and its good. So what would be returned if I loaded a model I made in 3DS max say and I called GetVertexDescription on the mesh? What data would it hold?

Share this post


Link to post
Share on other sites
Does DX10 even have the D3DXLoadMeshFromX function? - I guess not, what is the most commonly used file format for importing models in Dx10?

Share this post


Link to post
Share on other sites
Quote:
Original post by Maddius
Does DX10 even have the D3DXLoadMeshFromX function? - I guess not, what is the most commonly used file format for importing models in Dx10?


Your own format.
No more X files or any 'native' format at all.


Share this post


Link to post
Share on other sites
Quote:
Original post by dys129
You can also calculate tangent vectors on your own it's not that difficult (I'm doing that way). Here is good article how to do that: http://www.terathon.com/code/tangent.html.



404 Page not found

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!