Best way to load a 3D object into memory from a file?

Started by
4 comments, last by malhotraprateek 11 years, 1 month ago

I recently wrote a small program in c# to load 3D models from files like '.obj'. It parses the data and loads it in memory using regex and casts the values to doubles..

Then the program dumps this memory data arrays into a binary file, which can be readily loaded into my DX10 application.

Can anyone tell me if this is the best way to load a 3D object? (because I read it somewhere a long time ago)

I have been reading lots of tutorials about directx and I am trying to develop a simple 3d engine (in C++). (I frankly got sick of doing the small tutorials about triangle rendering and stuff..)

Also please give me some pointers on how should I go about on arranging the data in the file so that I would be able to pick up material and texture info too.. I am only working with vertex data for now.

I happen to have about 5 long months of doing almost nothing, so I thought I may just as well try learn about game programming by actually trying it out instead of reading the tutorials about it...

Also can anyone give me a link on how to interpret the DirectX debug output?

Thanks...

Advertisement

The way you are doing it is not a bad way of doing things. One of the advantage the way you are doing it, is that you can load different formats and dump it to an format that your dx app can load. I do something very similar in my engine where i have an external tool that loads .fbx,.obj and .ase to an format that my engine loads.

Well which tool do you use? The thing is I need all the stuff like vertex data, texture data, material data, animation data, etc in one format which i can then parse into my own format to load into my engine. From what I have read the .X format is the best at it, but it sounds very complicated with the bone hierarchies and stuff.

If the animation data is complicated in every format, then I guess I am stuck with leaning how to use it, however, if there is an easier way to access all these facilities in a particular format then I would like to stick with that format.

And if you could tell me about a good site for learning about directx debug output, that would be really nice.

Anyways thanks for your reply.

The tool is my own custom tool. It extract all the information about the an Mesh such as Vertices/Normals/Tangents/Bones information and store into an .gameformat which is custom. One of the format i can consider to look into is the .fbx format. You can used Autodesk fbx SDK to load .fbx models.

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=7478532

http://assimp.sf.net

Assimp supports importing a wide array of file formats.

Best way to use it is to import using assimp and export to your own format.

New C/C++ Build Tool 'Stir' (doesn't just generate Makefiles, it does the build): https://github.com/space222/stir

Thanks I will try both the techniques..

This topic is closed to new replies.

Advertisement