Sign in to follow this  
awood969

[DX10] Import .obj Files

Recommended Posts

Hi guys,

Question in the title: How do you import .obj files into DirectX 10? I realise that there is an example for this in the Microsoft SDK but to be honest I cannot make heads or tails of it.

Thanks
Andrew

Share this post


Link to post
Share on other sites
[quote name='awood969' timestamp='1298054460' post='4776016']
Hi guys,

Question in the title: How do you import .obj files into DirectX 10? I realise that there is an example for this in the Microsoft SDK but to be honest I cannot make heads or tails of it.

Thanks
Andrew
[/quote]

You can use the MeshConvert command line utility that comes with the SDK to convert to .sdkmesh format.

Share this post


Link to post
Share on other sites
I realise this however the .sdkmesh isn't recommended for use on anything but the MS Tutorials. Plus the models I have are in .obj format.

Thanks
Andrew

Share this post


Link to post
Share on other sites
Allow me to rephrase the question..;

I would like to know how to import mesh data from Blender to DirectX 10. Any file format that is offered ^^

Thanks
Andrew

Share this post


Link to post
Share on other sites
check out the library assimp http://assimp.sourceforge.net/index.html It can load many 3d file formats. Took my one cpp file to bridge the library to my engine and it was fairly easy.

Share this post


Link to post
Share on other sites
If you don't like .sdkmesh and the D3DX utility classes, then you either have to use a library like assimp to parse the model file format or you need to write your own parser/exporter. There's not really any other options.

Share this post


Link to post
Share on other sites
I understand, I am asking for some help with import code for one of the file formats that Blender supports. I only need the basics, wireframe, normals, UV Mapping. Nothing like bone structures etc.

Share this post


Link to post
Share on other sites
Since .obj files can be viewed as text, it shouldn't be too hard to write a basic importer to load the data from the file into an ID3DX10Mesh* object. I recently wrote an importer that did exactly this and it was pretty simple, just rigorous. Look through the example code for the demo that you mentioned earlier, provided with the DirectX 10 SDK. You only need to look at the small pice of code that reads the data from the file and none of the other DXUT stuff. All of the example programs included with the SDK are twice as confusing just because of all of the DXUT code thrown in there.

Share this post


Link to post
Share on other sites
There is plenty of information on the OBJ format, and is one of the easier to parse:

[url="http://en.wikipedia.org/wiki/Wavefront_.obj_file"]http://en.wikipedia.org/wiki/Wavefront_.obj_file[/url]

Share this post


Link to post
Share on other sites
The MS example seems entrenched with DXUT stuff and TBH i'm finding it very difficult to decypher it. There must be something else out there that describes mesh import?????

Thanks
Andrew

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