   Maya -- .X -- .X Vert Decl's ONLY -- App
  I'm looking at a .X file exported from Maya using the plug-in that comes with the latest DirectX SDK. Maya throws a bunch of vertex data into the .X that I don't necessarily want. It also chooses to use 3 floats sometimes, when I'd like to optimize and use D3DDECLTYPE_DEC3N, for instance.So, first of all, I'm trying to understand the .X format.1) It seems like every piece of information that can be represented by an FVF was represented using templates. And everything else (a 2nd set of texture coords, tangents, binormals) gets thrown into a vertex-declaration-template part of the file: DeclData { ... }. Is this accurate?2) I think I would like to take ALL data and put it under DeclData. Does it make sense to do this? How would I put indices (corresponding to position) under a vertex declaration?3) After everything is under DeclData { ... }, I could scan through that section and convert the data to the downsampled format I want. (3 floats -> D3DDECLTYPE_DEC3N, e.g.).Does this seem like an efficient pre-processing step to take things from Maya to a D3D app?P.S. It would be nice if dxops.exe could do something like this for you..EDIT: Hmmm, spoke too soon. I think dxops.exe can. Anyhow, questions still relevant. ^_^ Thanks.   
  It depends on how you want to load the .x file into your program.  If you plan to use the D3DX functions to do it, then you need to experiment to see if it re-creates your vertex buffer with the various vertex data that you see in the various templates.  I have no idea how it would handle a 2nd set of tex coords, binormals, and tangents.If you want to use the ID3DXFile interface, then you can do it any way you want.  You can parse and convert the data while loading it, or convert the data with another process before parsing it your program.  You can even use custom templates if you want.You can even write your own Maya .x file exporter if you want.  The important thing is to understand how the Maya exporter built the .x file templates so you can then load the data correctly into your DX app.   ;Quote:Original post by DXnutIt depends on how you want to load the .x file into your program.  If you plan to use the D3DX functions to do it, then you need to experiment to see if it re-creates your vertex buffer with the various vertex data that you see in the various templates.  I have no idea how it would handle a 2nd set of tex coords, binormals, and tangents.It throws the 2nd UV set (2nd only -- 1st set is in its own template), and the binormals and the tangents as three declarations into the DeclSpec { ... } section I mentioned earlier.Quote:Original post by DXnutIf you want to use the ID3DXFile interface, then you can do it any way you want.  You can parse and convert the data while loading it, or convert the data with another process before parsing it your program.  You can even use custom templates if you want.I'll have to look into 'ID3DXFile', never noticed it.Quote:Original post by DXnutYou can even write your own Maya .x file exporter if you want.Definitely an option... but some other time. I'm trying to learn one thing at a time.Quote:Original post by DXnutThe important thing is to understand how the Maya exporter built the .x file templates so you can then load the data correctly into your DX app.Right, that's what I was confused about. I did just now realize that you can call GetDeclaration() from the IBaseD3DXMesh object, and it does give me the exact declaration I want! (It includes both the things from the template, and all three formats from the DeclSpec { ... } segment.) I think I can go from here... Thanks! Though, I'll look at D3DXFile to see if it can do some downsampling for me.By the way: does anyone know how to convert a 32-bit float to a 16-bit float representation (a "half" on the GPU) in C++ (so I may then cast (encode) it as a short?) Is this an easier problem than it at first seems?   