   Computing tangents
  Hey,I am trying to get normal maps on my code but the models I have do not have neither the tangents or the binormals. Is there anyway of calculating these on the code?.I tried using D3DXComputeTangent() like thisD3DXLoadMeshFromX(path, D3DXMESH_MANAGED, device, &aBuff, &mBuff, 0, &nSub, &meshHandle);const D3DVERTEXELEMENT9 g_vertexDecl[] = {   {0, 0,  D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },   {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,   0 },   {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,  0 },   {0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 },   D3DDECL_END()};LPD3DXMESH newMesh = NULL;HRESULT hr = meshHandle->CloneMesh(D3DXMESH_MANAGED, g_vertexDecl, device, &newMesh);DWORD* pAdjacent = new DWORD[(3 * newMesh->GetNumFaces()) * sizeof(DWORD)];hr = D3DXComputeTangent(newMesh, 0, 3, D3DX_DEFAULT, true, pAdjacent);meshHandle = newMesh;but the D3DXComputeTangent fails. Any suggestions why?Any other ways off doing this?Cheers   
  You're passing "3" as your usage index for your tangent, while your tangent in your vertex declaration has a usage index of 0.Also if you have D3D or D3DX functions failing, you can turn on the debug runtimes and you'll usually get information on why they failed in the debug spew.   ;  You can always manually compute the tangents if you need to, this page will show you how and explains the mathematics involved: http://www.terathon.com/code/tangent.html