Sign in to follow this  
Tranq

DirectX 10 Mesh from a file (.x file?)

Recommended Posts

Hi all I'm learning DirectX10 at the moment and have set it up so I can create my own meshes by specifying verticies etc, now I'm wanting to load a mesh from a file. I'm planning on creating some models in either maya/3dsm, saving as .x and using these in the application, though I don't know where to start with this. I have also read in other threads/sites of Collada. Before I spent time looking into these I thought I'd run the tutorials and use their models to get an idea of what to do first. Using DX10 tutorial 09 it says to create a (in the SDK help file) CDXUTMesh10 g_Mesh; however the CDXUTMesh10 object doesn't exist as an object in my project (and can't find much on it on MSDN to find it's header), and when looking at the sample code it's self it doesn't even use this, instead it uses a CDXUTSDKMesh g_Mesh; (which is held in SDKmesh.h) The tutorial compiles and runs as expected from it's origianl location, but when I try and use the code in my own program I can't load any of the headers: #include "DXUT.h" #include "DXUTmisc.h" #include "SDKmisc.h" #include "SDKmesh.h" gets fatal error C1083: Cannot open include file: 'DXUT.h': No such file or directory any guidance would be great, links to tutorials/books/explinations as the process of how to do it etc Thanks

Share this post


Link to post
Share on other sites
Hi friend,

I think (with my little knowledge) that your projet had no link to the include path where the .h files are so there's 2 ways but I prefer the simplest one wich is the add in the headers files of your project the files missing.

you have to right clik in the project's header files->Add Existing items and then point all the files to include and that's it.

Hope I explained good the it must be done and sorry for my poor english

Peace

Share this post


Link to post
Share on other sites
Does that mean each model will have its own header files used to render it, or is this a common one for all models? Just a bit surprised that is isnt picked up automatically like some other dx headers (tho might be because i haven't set the linkers up - not at my machine to check) hope its as simple as that. Will have a go when i get back

Share this post


Link to post
Share on other sites
Have looked into it some more and the tutorials use DXUT (hence the header files), this is something I'm not wanting to do and so I'm not exploring that path. I've spent alot of time searching how to simply load a mesh (.x / .fbx etc) from a file and not found anything that sticks out for use in DX10. There is the function D3DXLoadMeshFromX for DX9, but can't find something like that for DX10.. must be going blind

Share this post


Link to post
Share on other sites
Hello again,

The include of DXUT framework isn't the same as DX headers, when you install the DXSDK it's automaticly add the path values in your VS directories configuration, DXUT are in another path, you can check that by :

include for DX headers path : c:\program files\dxsdk\include
include for DXUT headers path : c:\program files\dxsdk\samples\common\include

You have to point to that path in order to your compiler recognise this files and add them at compiling time, for fbx files, they're not supported natively in DXSDK (not like XNA wich support FBX Files).

Hope this help.

Peace

EDIT : there's a new mesh format for the DX10 SDK you need to check the samples codes

Share this post


Link to post
Share on other sites
D3DX10 was a little neglected when it came to mesh operations. From talking to the MS developers it seems to have been a case of priorities - most of their big clients (e.g. AAA game studios) have their own mesh libraries and/or use 3rd party middleware for this job. There simply wasn't enough pressure on MS to provide yet another mesh format and API.

fwiw, three things:
  1. the .sdkmesh format you see in some of the samples isn't to my knowledge officially supported. Be careful if you build code to depend on this as it may change without warning or be removed entirely.
  2. There is a MeshFromOBJ10 sample should you want to use OBJ mesh files
  3. I posted some code a while back on converting ID3DXMesh (v9) to ID3DX10Mesh. Provided you're happy with the extra dependency on a D3DX9 DLL this opens up all of the mesh routines you might be familiar with... as-is code here.



hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the info, makes sense about MS not being pressured into it, just thought they might have updated the .x or what ever to use the new buffering functions etc.
I decided against the SDK mesh and DXUT, instead have been writing my own *.obj loader to fit in with my current application. At the moment it reads in the verts, normals and texture values which can then be rendered. Just need to optimise it by making use of the indexing, also need to put in different materaial info (so differnt shapes can read from different textures), but this isn't a massive problem for this stage of development.
I had a look at the msdn page about MeshFromOBJ10, however I don't have the sample code in the DX10 directory, only in the dx9 one, which is a bit odd. Will be able to take some ideas from the 9 loader to add to my one at least.
Thanks again

Share this post


Link to post
Share on other sites
Hi Tranq,

First of all we must be honored by the answer of Mr Hoxley :P
For the Load mesh form OBJ, if you have the latest SDK (Nov2008) you can find the DX10 version in this path :

C:\Program Files\Microsoft DirectX SDK (November 2008)\Samples\C++\Direct3D10\MeshFromOBJ10

Hope this helps

Peace

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this