Sign in to follow this  
rpulley123

3D

Recommended Posts

Hi, I've been playing around with game development for a few years now, I've always been into 2D tile based games. I want to get more into 3D game programming more now. I've played around with it a bit, but so far I've only created a little configurable 3D map game with no real content other than displaying and moving through the maps. The thing that's really holding me back is a lack of knowing which tools to use for modeling, and how to load the models from whichever tool. I played around with the learning edition of Maya and with the Milkshape 3d program, but I'm not sure what format would be best and how I would load the models. I know how to load the .x files since DX has support for them, but I can't seem to find a tool that really exports to the .x format very well, everything I've seen so far either doesn't support that format or has problems when exporting to it. I've bought a few books on 3D programming but none of them answer these specific questions, they mostly spend 50% of the book teaching you what C++ is, 30% teaching you what DX is, then the other 30% teaching you how to rotate a triangle on the screen. Can anyone point me in a good direction here? Thanks! -- Rocky

Share this post


Link to post
Share on other sites
i had the same problem also. i could make 3d pong, i could make a basic 3d level from cubes etc. but i couldnt get models to load. it was just to huge to conquer all at once so i just started using a pre-made 3d engine. from this i can get in depth with actually up-to-date games as i would be working in 3d and not have to worry about loading specific types of file formats or real indepth matrix calculations and the such. although i'm using a pre-made 3d engine i'm not going to abbandon the knowledge that it takes to create a 3d engine. i always think it is usefull to know what is happening behind the scenes, so every now and then, slowly but surely i try and learn the components / systems that goes into a 3d engine.

currently i am using the irrlicht engine.

Share this post


Link to post
Share on other sites
Hi,

OK - you're after directX, which I know relatively little about. However, there is plenty of model loading information using openGL (although the loading info might still be useful) here.

If you don't want to build your own models, then you can find a plethora at polycount.

Quote:

I've bought a few books on 3D programming but none of them answer these specific questions, they mostly spend 50% of the book teaching you what C++ is, 30% teaching you what DX is, then the other 30% teaching you how to rotate a triangle on the screen.


They obviously spend -10% of the time teaching addition :)

HTH,
Jim.

Share this post


Link to post
Share on other sites
Quote:
Original post by JimPrice
Hi,

OK - you're after directX, which I know relatively little about. However, there is plenty of model loading information using openGL (although the loading info might still be useful) here.


I could try Open GL as well if it has better model support. I've used SDL somewhat but never for 3D programming so far.

Quote:

They obviously spend -10% of the time teaching addition :)


No, I think I must have spent %10 of my time ignoring the math section that took up another 30% of the book. :)

I'll check out the links.

Thanks,
-- Rocky

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The thing about model loading is that every model has a different format and features - oh WOW really?! Shocking I know. All model formats store vertices, triangle indexes, texture coordinates, material information etc.... But the key is to findout how the model stores this info and in what order. Some model formats are binary (md2) some are text (.obj) some have bones (.ms3d) some have keyframes (md2 again) some are static (ac3d?).

Here's a good learning exercise I did: the model loading code on gametutorials.com is ATROCIOUS horrible code. Rewrite it, load the data then stick it in your own format. I don't like having a bunch of intermediate structures like tris etc... so I used an array of vertices, an array for triangle indices, an array of text coords, an array of normals, whatever.

Share this post


Link to post
Share on other sites
Quote:

opengl is a graphics api and has no "feature" for direct model support for specific model file formats...:)


If this is directed at me - yup, I know - I meant the rendering was done with openGL in the links, but the loading information was still relevant.

Quote:

Here's a good learning exercise I did: the model loading code on gametutorials.com is ATROCIOUS horrible code. Rewrite it, load the data then stick it in your own format. I don't like having a bunch of intermediate structures like tris etc... so I used an array of vertices, an array for triangle indices, an array of text coords, an array of normals, whatever


Agreed - but it's an opportunity to see how you might load an MD2/3 file, for example. Longer term you want to find the file specification documents - if you can translate these into a loader into your own model-storage type (so you have a CModel class with CModel::LoadMD2, CModel::LoadMD3, etc.) then you'll learn a lot more, and have a lot more flexibility.

Personally I'd use std::vector instead of arrays, but whatever floats your boat!

Jim.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Here's a good learning exercise I did: the model loading code on gametutorials.com is ATROCIOUS horrible code. Rewrite it, load the data then stick it in your own format. I don't like having a bunch of intermediate structures like tris etc... so I used an array of vertices, an array for triangle indices, an array of text coords, an array of normals, whatever.


That is exactly what I did. I started with the obligatory "initialize the API with absolutely nothing in it but a blank screen", Then triangles, then textured cubes, then models. I have so far been successful in devising my own text-based model format where I specify an array of vertices, an array of text coordinatess, an array of normals, and an array of bones. I can even load it in D3D and OGL. I guess when you have hurdled the basics, 3D is not so bad after all.

And oh, I agreee how atrocious some model loading codes can get. I can remember researching how to load text .x files and the examples I saw easily had a hundred or so lines of code. My own format (which was patterned a bit after .x files) could be loaded with only 15 lines of code.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Here's a good learning exercise I did: the model loading code on gametutorials.com is ATROCIOUS horrible code. Rewrite it, load the data then stick it in your own format. I don't like having a bunch of intermediate structures like tris etc... so I used an array of vertices, an array for triangle indices, an array of text coords, an array of normals, whatever.


Sounds like a good plan, I'll try it out... Is there any format you would suggest? I'm thinking that I'll try the .obj format, the MD4/5 formats are for quake right? I don't have that game, but maybe I'll grab a copy.

-- Rocky

Share this post


Link to post
Share on other sites
Quote:
Original post by JimPrice
Quote:

opengl is a graphics api and has no "feature" for direct model support for specific model file formats...:)


If this is directed at me - yup, I know - I meant the rendering was done with openGL in the links, but the loading information was still relevant.




nope, it was directed to rpully123 when he said:

Quote:
I could try Open GL as well if it has better model support. I've used SDL somewhat but never for 3D programming so far.



:)

Share this post


Link to post
Share on other sites
Well, I downloaded the two samples from gametutorials.com, the 3DS one and the OBJ one. I would rather start with the OBJ one, but first I wanted to make sure that I could create my own model and load it. Using MilkShape3D, I exported to "Wavefront OBJ" format and the mesh displayed with the tutorial app was completely wrong, just a bunch of stray lines. When I exported it to "Autodesk 3DS" format, it displayed just fine with the 3DS tutorial app. I guess that I'll start with the 3DS one, unless someone can suggest a better tool for generating OBJ files than milkshape 3d.

Thanks,
-- Rocky

Share this post


Link to post
Share on other sites
Quote:
Original post by rpulley123
Well, I downloaded the two samples from gametutorials.com, the 3DS one and the OBJ one. I would rather start with the OBJ one, but first I wanted to make sure that I could create my own model and load it. Using MilkShape3D, I exported to "Wavefront OBJ" format and the mesh displayed with the tutorial app was completely wrong, just a bunch of stray lines. When I exported it to "Autodesk 3DS" format, it displayed just fine with the 3DS tutorial app. I guess that I'll start with the 3DS one, unless someone can suggest a better tool for generating OBJ files than milkshape 3d.

Thanks,
-- Rocky


It ain't Milkshape 3D which is wrong, it is the tutorial. The tutorial is aimed only to load a little bit of the .obj file format, just enough to display their model. Other models may or may not have much more information, and therefore the structure of the file is a hole lot different... For instance, if the model contains keyframes, splines etc. Check out http://www.wotsit.org for information about most file formats, including 3ds and obj.

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