Compute Tangent

Started by
10 comments, last by maxgpgpu 14 years, 10 months ago
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.
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.

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?
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.
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.
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?
Does DX10 even have the D3DXLoadMeshFromX function? - I guess not, what is the most commonly used file format for importing models in Dx10?
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.


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
Do not copy dot from the end of the sentence to your browser. Sorry I'm new here :) Here is how it should be : Computing Tangent

This topic is closed to new replies.

Advertisement