Sign in to follow this  
VRock

Trying to create a model loader of some sort (DirectX)

Recommended Posts

VRock    100
Hello all,

I'm trying to create a model loader of some sort for a project I'm working on. I've looked into .X and .FBX but I cannot use .X because it's native support in DirectX10 is dead so I can't do it the easy way and .FBX looks insanely complicated... I honestly don't know where to start! I've been searching on the Internet for the past 3 hours now!

All I need is the Vertex data, the Normal data, and the Texture UV data... I work with DirectX10 and 3ds Max 2011.

If anyone could give me some help or point me in the right direction I would really appreciate it!

Share this post


Link to post
Share on other sites
VRock    100
Sorry for the late reply;

I think I don't have to create my own but I think I should because I could really use the experience.

Thanks for the link to ASSIMP, though! I'll be checking that out.

Share this post


Link to post
Share on other sites
karwosts    840
OBJ is probably the easiest format to start with for beginners. It has a fairly simple spec and is pretty ubiquitous. It doesn't support some of the more complex things you might need from a format (LOD, animations, etc), but for beginners it should suit your needs pretty easily. I think most modelling programs have obj exporter as well.

I'd start with that if you just need something quick and fairly easy for a beginner.

Share this post


Link to post
Share on other sites
mixmaster    373
We all face this problem at some point in our GameDev. I used lots of external libraries at first, BUT they all had issues. In the end I sucked it up and wrote an export script for Blender, it wasn't as hard as I thought. Once I had my file format worked out, very close to .obj except I include materials in the same file. I just wrote the importer. Its worth the effort.

I'll be putting my scripts online soon for others to use. for now I can email it to you with my full import code in C++, if you like.

Share this post


Link to post
Share on other sites
VRock    100
That seems like a good idea. Would you mind pointing me to a tutorial of some sort to help me get started? I searched for a good half an hour now on Google and I couldn't seem to find any...

Edit: Did not see your post, mixmaster.

Sure thing, if you don't mind. My email is vinchenz(at)gmail(dot)com. I could really use all the help I could get. I can mess around in DirectX quite a bit now but I don't know where to start when I'm working from scratch.

Share this post


Link to post
Share on other sites
karwosts    840
Quote:

In the end I sucked it up and wrote an export script for Blender, it wasn't as hard as I thought. Once I had my file format worked out, very close to .obj except I include materials in the same file. I just wrote the importer. Its worth the effort.


I've gone down this path before, and while I can see the upfront appeal, I would now have to say I recommend against it. Using custom formats are fine for your game, but writing your own exporter I think is a bad idea. Back last year I thought the same thing and I made a really nice binary format, multiple uv levels, multitexture, vbo optimization, all kinds of nice goodies, and worked out an exporter from blender to put it all together.

Today blender is moving on to a totally new internal API and my original script that I spent weeks on is useless now.

I think it's much better to write a converter instead of an exporter, maybe from a common interchange format like collada.

You may think your toolchain will be static forever, but this is a big risk.

In the end let's say you write a blender exporter for your own format.

Want to upgrade to the latest version of blender? You're SOL.
Someone on your team wants to use 3dmax? You're SOL.
Want to try a new version of Maya? You're SOL.
Want to import a model you bought on the internet? You're SOL, unless blender can import it perfectly into the exact format it needs to be to be reexported, and this is still an unneeded hassle.

In all of the above cases you'd have no problems if you just made a converter for a common stable format. You can bet that every version of every modelling package out there will support some set of common export formats, and they'll be thoroughly stress tested and maintained to be up to date.

Just my opinion.


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