• Advertisement
Sign in to follow this  

DirectX File Formats and performance

This topic is 4266 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heyas Im quite new to DirectX, in fact Im about to start. My question is what file format you use in DirectX? I was under the impression most would draw their 3d Object in a 3D modeller like Maya or 3D Max and then make it useable in DirectX... usually by exporting it into X file and then loading it. Thing is... isnt X file a text file? is there a way to optimise the loading of an X file... like having it in binary format? Also... if you did create a game with X files how would you package them? in a directory with loads of .X or inside a resource file... is there a better way? Are there any other types of 3D files that DirectX can read? like reading directly a .3ds file or something? Ive heard that .X files arent very good for animations, true? or is it just because exporting them from other formats usually causes trouble? And what tools do most of you use for 3d moddeling with DirectX rendering? 3DMax and Maya are extremelly expensive for messing about with and blender just doesnt seem to be very DirectX compatible (might be wrong here). Thanks for reading it and I would appreciate it if you could also answer ;p! Yours Truly K

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by BloodWarrior
My question is what file format you use in DirectX?
I was under the impression most would draw their 3d Object in a 3D modeller like Maya or 3D Max and then make it useable in DirectX... usually by exporting it into X file and then loading it.

I haven't researched it, but I guess that is what most people do.
Commercial games probably use their own formats.

Quote:
Thing is... isnt X file a text file? is there a way to optimise the loading of an X file... like having it in binary format?

[EDIT No, it's binary. Open one in notepad for instance, and see for yourself. appearantly it can be both (see post below), I've never used the text version. Don't listen to me, I'm a fool. ;)]

For loading this model format, you can use the helper functions in the D3DX utility library. I don't think there's any point in trying to optimize these procedures, and since you're are a beginner to DirectX, I'd suggest to just stick with them.

Quote:
Also... if you did create a game with X files how would you package them? in a directory with loads of .X or inside a resource file... is there a better way?

All depends on things like total file size or the way you want to distribute them. The easiest thing to do is just put it in the application directory or subdirectory and load it from there. It is also possible to add them as resource, which may be a good idea for small applications and a low number of meshes. A third option would be to zip all 'em all and extract them at run-time.

Quote:
Are there any other types of 3D files that DirectX can read? like reading directly a .3ds file or something?

Not that I know of. However, there is a tool called conv3ds which can convert 3DS files to X files. If you are prepared to write your own model loading code, you can use whatever format you want, including your own defined format.

Quote:
Ive heard that .X files arent very good for animations, true? or is it just because exporting them from other formats usually causes trouble?

I'll leave this to someone else. :)
It can be done, but I don't know what is best to use.

Quote:
And what tools do most of you use for 3d moddeling with DirectX rendering? 3DMax and Maya are extremelly expensive for messing about with and blender just doesnt seem to be very DirectX compatible (might be wrong here).K

There's no such thing a DirectX compatible mesh formats. The X format is easy to use because of the D3DX library, but apart from that, meshes will always have to be "converted" to vertices. The graphics card doesn't know anything about mesh file formats. Blender is a great modeling tool, although it takes a while to learn how to use it.

Share this post


Link to post
Share on other sites
>My question is what file format you use in DirectX?
assuming u r talking about direct3d,i use Xfiles.

>Thing is... isnt X file a text file? is there a way to optimise the loading of an X file... like having it in binary format?
Xfile can be both. especially binaly format can be compressed format.

>Also... if you did create a game with X files how would you package them? in a directory with loads of .X or inside a resource file... is there a better way?
if commercial level,i did package them all.
usually ,(some samples for book or samples for students)i take easier way,put files in specific directly.

>Are there any other types of 3D files that DirectX can read? like reading directly a .3ds file or something?
it depend on u implement load module of function.u can do anything.
in fact,my 3dapp can load .lwo and .lws directly.(lwo=lightwave obj lws=lightwave scene files)

>Ive heard that .X files arent very good for animations, true? or is it just because exporting them from other formats usually causes trouble?
I dont know.
at least i can say,it very hard task that create format that can beat Xfile.

>And what tools do most of you use for 3d moddeling with DirectX rendering? 3DMax and Maya are extremelly expensive for messing about with and blender just doesnt seem to be very DirectX compatible (might be wrong here).

"I THINK"
in amature,its lightwave3D.
in studio,3dsmax and maya.
be carefull,if u r thinking to buy maya or max,u will get some trouble i guess.

gl.

Share this post


Link to post
Share on other sites
Thanks Dudes!

I will then try to learn more about .X format.

katsh why do you say Ill get into trouble if I buy the Maya or 3DSMax licenses?

Im going to try to get used to modelling using Blender (found a plugin that exports into .X format).

And ill go from there.... baby steps ;p!

once more
Thanks!
Yours Truly
K

Share this post


Link to post
Share on other sites
>katsh why do you say Ill get into trouble if I buy the Maya or 3DSMax licenses?
cuz i ve been hearing troubles about those 2 app. at least since 2years ago.

Blender.oh cool.i heard it hard to use.

but gl.

Share this post


Link to post
Share on other sites
Well, I am not sure about this, but there is always a *.dll file. Sure, you need an entry point into the file like a Main declaration, but perhaps, storing the info in different functions may be something that can be done. But not sure, how that would go, or if it would be useful. The other thing they actually do is either go by the engine they are using, or build a set of tools to read the format they want, which would be handled in another Class or Function into the program.


Share this post


Link to post
Share on other sites
hm... I was just wondering...

since you can create your own reader for .X files...

Why not create a parser that converts a .X into a .cpp file. So that the entire structure would be already compiled and loaded into the dll as a pre defined variable in a DLL.

Does anyone know if we would gain any performance in this? Technically this would increase the size of the dll that holds them... so it would probably be placed in virtual memory? so that when we asked for a structure it might have to read it from the disk instead of from cached memory... would it load the entire dll back into memory?
Or would it always have to keep the dll in RAM thus filling it up abominably?

Im not sure if this is such a good idea now... Im thinking a cache manager would probably be better than this since it would allows us to control what is loaded or about to be loaded.

Im not really good at this level of software/hardware. Does anyone know if there would be any advantage in this?

Yours Truly
K

Share this post


Link to post
Share on other sites
Hi Warrior,

just don't do that... Use the binary file format if you like, or define an own
(which I wouldn't recommend for a beginner, just work you don't need to do).
Discarding all other (good) reasons:
Think about 200 meshes for your game each of a size of 1.5 MB;
Do you really want to have 300 MB data in a dll?
Don't think so.
If I was you, I'd just stick to what WanMaster said.
Use a ZIP file or sth. similar when you have need for it.
But you won't have at the beginning - just put the meshes in the application
path(/subfolder)as long as you're just trying around a bit.


Good Luck,

Martin

Share this post


Link to post
Share on other sites
Yeah... you guys are right.
I kinda figured .X == text files == very little space but apparently I was very wrong.

No I think zlib is the way. Implement a small dll (or stick it in an utilities/services dll) that enables deflating/inflating of our own resource files.

And yes, for test purposes I definately am using everything just dumped with the compiled version.

Thanks!
Yours Truly
K

Share this post


Link to post
Share on other sites
As I recall, .x files store the animation data along side the model data, which may or may not be ideal for what you're trying to do. That might be the reason you've heard they weren't good for animations.

For example, if you wanted a bunch of different human type models that share a common pool of animations( walk, run, jump ), then .x files might not be the best solution.

That said, there's no easier way to get 3d models rendering in dx that I know of, so they're definately a good place to start loading models from files.

I could be wrong, it's been a couple years since I last looked at a .x file.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement