Xbox LIVE Indie Games
Sort Discussions: Previous Discussion Next Discussion
Page 1 of 1 (14 posts)

how load .x file extension in directX10?

Last post 10/6/2017 4:35 PM by Tarh Ik. 13 replies.
  • 6/25/2012 12:42 AM

    how load .x file extension in directX10?

    i can't found the way to do it without call DXUT.h include files, i want know what dx10things to use to do
  • 6/25/2012 6:04 PM In reply to

    Re: how load .x file extension in directX10?

    Answer
    Reply Quote
    .X is legacy and is not supported beyond Direct3D 9 and D3DX9--it actually dates back to DirectX version 3 and Direct3D Retained Mode.

    For Direct3D 10.x and Direct3D 11.x samples, the samples use .sdkmesh which is not ideal for production use but works. It is created by the Samples Content Exporter which uses Autodesk's FBX format for import. <http://go.microsoft.com/fwlink/?LinkId=226208>

    So with .X models you have 3 basic routes:

    (1) Find a converter to get .X models into your modelling program of choice, clean them up, and then export them to Autodesk FBX

    (2) The DirectX SDK (which is also legacy) has a little "MeshConvert" utility which changes .X files to .SDKMESH which is a quicky way to get it to work that was used for the Direct3D 10 samples.

    (3) You can find some code on the internet where people use the legacy D3DX9 library to load .X files into ID3DXMesh, then copy all the data out into a ID3DX10Mesh. This is not really sustainable long-term and wont' work for Direct3D 11. D3DX9 & D3DX10 & D3DX11 are all legacy at this piont, and ID3DX11Mesh does not exist in D3DX11 anyhow. Note having a better mesh story is an issue we're hoping to address with DirectXTK in the long-term, but we'll be focusing on Autodesk FBX and not trying to ressurect X files.
  • 6/26/2012 3:25 AM In reply to

    Re: how load .x file extension in directX10?

    what I'm trying to do is create an application for windows 8 for sell it, and maybe the use of SDK's supposed "free"(with non commercial use)."will carry law problems" in example the use of the Autodesk FBX SDK.

    I've reading that to draw or load a file I must use a "LoadFromFile" function that read the file but you tell me that these is not supported anymore in Dx10 or 11 and all tutorials for do that use the directX9 that are so old so I have two options find another way to do that or use DirectX9 for the appliication but I'm not sure if Windows 8 support the old SDK....

    mm I don't know....!? 
  • 6/26/2012 6:29 PM In reply to

    Re: how load .x file extension in directX10?

    For Metro style app development you must use Direct3D 11, and no version of D3DX is valid for use in Metro style apps--if you try to include D3DX9, D3DX10, or D3DX11 in your package it will fail the Windows Store validation.

    At the moment, the only Microsoft sample code for drawing meshes that currently exists for Metro style apps is the Metro style samples, such as Marble Maze. It uses .SDKMESH as the runtime format for it's data.

    I can't speak to the Autodesk FBX license agreement. This thread seems to go to your question, so I'd follow up there.

    As I said, we hope to address the mesh scenario more fully with DirectXTK, but for the moment you are on your own or you can use the standard procedural stuff like spheres, cubes, etc.
  • 8/13/2012 7:37 AM In reply to

    Re: how load .x file extension in directX10?

    Is it not possible to write your own classes to read in meshes of different formats?
  • 8/13/2012 9:38 AM In reply to

    Re: how load .x file extension in directX10?

    tadmiral:
    Is it not possible to write your own classes to read in meshes of different formats?

    Yes it is possible but if you have ever tried you would know how difficult it is!

    Most 3D file formats are poorly or confusingly (for the non-expert) documented and invariably have different versions of the format to complicate things.

    In XNA Microsoft chose to use the Autodesk FBX SDK and still they have peculiarities with their supported FBX formats compared to those possible from different applications like 3DS Max and Blender.  Some FBX files work and others do not.

    I re-wrote parts of the Blender FBX exporter to work correctly with XNA 4 just so I could continue to work on Diabolical: The Shooter.  It was many weekends investigation and trial and error just to make a few changes to get the exporter working!

    The problems are not unique to XNA it is because the 3D graphics formats have too many different ways of doing things.

    The Autodesk FBX SDK is a good choice for developer use but the licencing conditions may or may not make it difficult to use to load files at run time.  You would need to check the licencing conditions.  It would still need a lot of work to get that working.

    I see more support for FBX but collada is also quite common.  I have seen a few projects to import Collada but have not tried them to know if they are any good.

    Google SketchUp uses a zipped up version of Collada for its files and Autodesks FBX converter can convert from Collada so supporting FBX means you can also easily use Collada files.

    Regards
  • 8/13/2012 9:49 AM In reply to

    Re: how load .x file extension in directX10?

    Sounds to me that we indies need to make an open source media format to stop this sort of thing happening.
  • 8/13/2012 10:25 AM In reply to

    Re: how load .x file extension in directX10?

    tadmiral:
    Sounds to me that we indies need to make an open source media format to stop this sort of thing happening.

    That would already be Collada:
    https://collada.org/

    It would take too many years to start again!
  • 4/1/2013 2:24 PM In reply to

    Re: how load .x file extension in directX10?


         Hi Charybdis,

    Charybdis:
    ...but we'll be focusing on Autodesk FBX and not trying to ressurect X files


         I know that "X" files are considered old, but maybe there could be a way to suggest considering backward-support, just like some other Microsoft products offer. I spent quite a lot of time learning X files, as that was the "standard" when XNA was first released. After all, "X" files can be very flexible: I'm able to use the same animation file for different models, slow down animations by inserting in-between frames, interchange textures as needed, hair animation and face expression, all of this with almost no load time. I understand that "fbx" are no where that flexible.

         Any consideration would be greatly appreciated

  • 5/15/2014 4:15 AM In reply to

    Re: how load .x file extension in directX10?

    Hi Everybody!!!

         So... I'm using "X" files with Direct3D 11 for a "Metro" application for Windows 8 (actually, I'm aiming for the Xbox One, but Windows 8 is an intermediate step, according to ID@xbox). I assume that, likewise, it should be possible for Direct3D 10.

    JCBDigger:
    tadmiral:
    Is it not possible to write your own classes to read in meshes of different formats?

    Yes it is possible but if you have ever tried you would know how difficult it is!


    Well... it is not difficult. It is a tad laborious, I grant that. However, once it is understood that there is only buffers of data, then a routine can be created that reads the "X" file as a stream of text and then build the vertex and index (face) buffers straight to the shader. That is what I did: I started with the CreateFile2 function, and 20 hours of development later I can draw on the screen a model from an "X" file.

    JCBDigger:
    Most 3D file formats are poorly or confusingly (for the non-expert) documented and invariably have different versions of the format to complicate things.


    Actually, I found that the format of an "X" file is very well documented, compared to other formats. I've found the best source of information in old books (circa 2000 - 2005). When it comes to on-line sources, the best documentation I've found is here:

    http://msdn.microsoft.com/en-us/library/windows/desktop/bb173015.aspx

    I do grant that experience using (and writting) X Files is needed in order to understand the process. However, I can sumarize it as follows:
     * Mesh: This one contains your vertices as 3D coordinates, and your faces (this will be referred as "index" buffer, I'm not sure why)
     * MeshNormals: This one contains your normals, and they should match the information in "Mesh"
     * MeshTextureCoords: This one contains the texture coordinates PER VERTEX
     * Material / MeshMaterialList: I use these ones a lot, although I've been advice not to use too many of them.
     * SkinWeights: These ones are your weights for skinning (if you're using them)
     * Frame: These ones are your skelleton of bones.

    Everything else I pretty much ignore it.

    Charybdis:
     ...but we'll be focusing on Autodesk FBX and not trying to ressurect X files. 


         If I could suggest reconsidering supporting X Files for simple 3D models. Really, it is not that difficult.

         I hope it helps!!!!

         Tarh Ik
    PS: This posting has been posted "AS IS"

  • 5/15/2014 9:13 PM In reply to

    Re: how load .x file extension in directX10?

    Parsing a subset of uncompressed binary .X files is not challenging as you note, although you do have some major challenges mapping the Direct3D 9 Vertex Decls.  The problem is that real .X file support also means handling ASCII .X files, and compressed ASCII or binary .X Files. And doing all that without using the legacy D3DX9 DLL.
  • 5/16/2014 5:07 PM In reply to

    Re: how load .x file extension in directX10?

    There's an open source project that reads .x files http://assimp.sourceforge.net/ though I'm not sure if it uses D3DX9 under the covers - you could use that as part of a content pipeline to at least get things in a format you want.
  • 5/16/2014 7:16 PM In reply to

    Re: how load .x file extension in directX10?

    Hi Charybdis, Z Man,

         Thanks for the info!!! I'll look at it and use it in my routines.

    Charybdis:
    ... you do have some major challenges mapping the Direct3D 9 Vertex Decls


         I totally agree with you. For instance, "X" files support faces of 4 sides, whereas, if I understood correctly, Direct3D accepts only triangles. So, for every 4-side face I had to split it in two triangles, which caused an offset in my MaterialList indexes.

         I'm trying to stay away from D3DX as it doesn't seem to be supported any longer, as denoted by the following article:

    http://blogs.msdn.com/b/chuckw/archive/2013/08/21/living-without-d3dx.aspx

         Nevertheless, I should check the Asset Importer Tool.

         Thanks again!!!

         Tarh Ik
  • 10/6/2017 4:35 PM In reply to

    Re: how load .x file extension in directX10?

    Hi Everybody!!!!

         I just updated this research and implemented it in a 3D model design tool for Windows 10 using DirectX 11 and XAML, compiled as a UWP application. I know, it is five years too late, but I made a big effort to document the interaction between XAML and DirectX so other devs can speed up the learning curve for this technology:


         I hope it helps!!!

         Tarh Ik
    PS: This posting has been posted "AS IS"
Page 1 of 1 (14 posts) Previous Discussion Next Discussion