   D3DXComputeTangentFrameEx()  problem
  After loading a mesh with D3DXLoadMeshFromX(), I use CloneMesh() to duplicate it, with a tangent, binormal and normal included in the submitted D3DVERTEXELEMENT9-array.Then I make this call: D3DXComputeTangentFrameEx(pMesh, D3DDECLUSAGE_TEXCOORD, 0, D3DDECLUSAGE_TANGENT, 0, D3DDECLUSAGE_BINORMAL, 0, D3DDECLUSAGE_NORMAL, 0, D3DXTANGENT_GENERATE_IN_PLACE, (DWORD*)pAdjacency->GetBufferPointer(), 0.01f, 0.25f, 0.01f, NULL, NULL)But with certain objects, D3DX complains about vertices have to be split, and therefore won't fit in the mesh to be generated in.How do I get the amount of resulting vertices of this operation, so that I can create a fitting mesh?Is there any other workaround to this problem? I have experimented with the threshold-parameters passed to the function, but it doesn't seem to help.   
  Try to let it create an output mesh and then release your original mesh.  Maybe that will let you keep making progress.I've run into a few problems with this function before.  Underneath, it is doing quite a lot of stuff, and I have found that putting as few restrictions on it as possible generally gives the best results.neneboricua   ;  It could be worth trying to use D3DXValidMesh() and/or D3DXCleanMesh() to see if you can sort it out before D3DXComputeTangentFrameEx().I noticed that the uvatlas comand line tool does a number of similar steps before it starts processing - to make sure that an arbitrary mesh is in an appropriate form before it starts work...hthJack   ;  neneboricua:I've tried that also, but without success. According to the SDK:"If D3DXTANGENT_GENERATE_IN_PLACE is not set, the input mesh is cloned. The original mesh must therefore have sufficient space to store the computed normal vector and partial derivative data."So, apparently I have to know the size of the resulting mesh, regardless how I create it. It would really be convenient if there was any software out there that took care of this computation and stored a new .x-file. Do you know of any?   ;  jollyjeffers:Haven't tried that out, but will. Thanks.   ;Quote:Original post by Moldieneneboricua:I've tried that also, but without success. According to the SDK:"If D3DXTANGENT_GENERATE_IN_PLACE is not set, the input mesh is cloned. The original mesh must therefore have sufficient space to store the computed normal vector and partial derivative data."So, apparently I have to know the size of the resulting mesh, regardless how I create it. It would really be convenient if there was any software out there that took care of this computation and stored a new .x-file. Do you know of any?Yes, the docs are correct, the input mesh will be cloned.  The input mesh needs to be the appropriate size if you choose to generate all the data in-place.  However, if you let the input mesh be cloned, the new mesh will be created with necessary space for all the data.  Try it and you'll see.  I've done it before.All you need to do is create a LPD3DXMESH variable and pass in its address to the function and the D3DX function will take care of creating a mesh of the appropriate size and filling it in with the correct data.neneboricua   