Skip to main content
GameDev.net gamedev.net
🔒 Locked

Is it possible to handle shapes made in 3D Studio from C++ (or another language)?

Started by marianodonati Jul 5, 2009 at 12:02 PM 7 replies 1k views
Original Post
marianodonati
marianodonati
Hi to everyone. Let me introduce myself first: my name is Mariano Donati, i'm From Argentina and i've been programming for 7 years in different languages as Java, C#, C and on the web with Php and Asp. Tired of making administrative and management applications, i decided to make a turn in my career and to start to develop games. I know it will not be easy, but i think it's matter of passion. And I have it. The first thing i want to ask is if it is possible to handle shapes made in 3D studio from any language. I've heard it some time ago, and I never checked it out. If it so, is there any good tutorial about it?. The second thing i'd like to ask is what is the way i must start?. I've made some games, like arkanoid, tetris, bouncing ball and games like that, so i know about game loop, some basic physics, events, etc. The first real project i want to face is to make a 3D card game. So, I have some experience with 3D studio and i'd like to design my models in it and do animations, movements and logic from a language that i know. Any suggestions, advices, etc would be really appreciated. Best regards.
bzroom
bzroom
Yes, any language which has the ability to read a file will be able to parse data generated from 3d studio. The choice is yours.

Then the question becomes, how to make a file which you will be able to interpret after you open it. The .max scene file is out of the question, it's binary and proprietary. There are infinite other options though. The .3ds is popular and you can find loader tutorials on the web for it. There's also .obj which is very simple, plenty of autocad formats and various CAD formats. Iges comes to mind. There's Collada, and last there is your own custom format, which is what i use.

With the max sdk you can write your own exporter which will traverse the scene in max and export only the information relevant to you. Pre-canned exporters do the same thing, you'll just need to choose one which gives you the information that you desire. Which typically is at least the geometry and material information.
marianodonati
marianodonati
Thanks for your reply. So, the way it's done is to parse 3ds, obj, etc file and after parsing give the result to the game engine to draw images, do animations, etc?. Is it like you obtain the info wich the game engine will work from those files?. If it's not, I think that i've misunderstood something. I'll be thankful if you explain it to me how would i do this.

Thanks in advance.

Best regards.
bzroom
bzroom
Yes, you've got it correct.
RyanPridgeon
RyanPridgeon
You will have to use a reference to find out the way the 3d Studio file is structured, and use that to write a parser. Then just design your parser to put the information into a format that your engine can draw, or vice versa.

If you know what you're doing with file reading and your graphics API, you should be fine.

Also check this out http://www.martinreddy.net/gfx/3d/3DS.spec
marianodonati
marianodonati
Thanks for your answers. I also have found this: http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-info.txt, maybe it's useful for somebody else who is starting with game developing as well.

Best regards.
bzroom
bzroom
I would suggest you start with .obj. The .3ds is a tad complicated. The .obj is simple text based, it'll get your project rolling really fast and you can replace the loader and format later.

You'll want to structure your loader as a free function to make that easier later.

struct Model
{
std::vector meshes;
std::vector materials;
std::vector bones;
std::vector attachPts;
};

bool LoadModelFromOBJ(const File &file, Model &modelOut);
bool LoadModelFrom3DS(const File &file, Model &modelOut);
bool LoadModelFromCustom(const File &file, Model &modelOut);

If you change formats the only thing that changes is that single function, none of the Model or anything referencing it.
marianodonati
marianodonati
It looks quite simpler than 3Ds files. I think you're right, i'll start with this.
Thanks.

RobTheBloke
RobTheBloke
Quote:
Original post by marianodonati
It looks quite simpler than 3Ds files. I think you're right, i'll start with this.
Thanks.


Don't. It's useless. The best bet (imo) is to use the ascii export example from the devkit and modify that (by default the SDK is not installed, so re-run the installer to get it). Both obj and 3ds are pretty rubbish, and you will end up needing more than they offer before too long.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.