Sign in to follow this  
malhotraprateek

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

Recommended Posts

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...

Share this post


Link to post
Share on other sites
BornToCode    1185

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.

Edited by BornToCode

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
BornToCode    1185

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

Edited by BornToCode

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