How to make 3D model move in game
Hello
I want to manage 3D model (made in e.g. 3ds max) in game (C++,WinAPI,OpenGL) i.e. I have some monster with texture on it.. how to import it into game (I have window in WinAPI and OpenGL initialized)?
Some theoretical question:
If I want to make my monster run I must make animation in 3ds max and then write in e.g. C++ some code to import and start this animation?
Or I import only 3D model and all animations: running, sitting etc. I must write in C++ (I think it would be very laborious but I'm not sure whether first or second or some other version of creating animations in game is true... so I ask:)
How does it works?
Greetings
Why don't you use an existing engine (such as Ogre, Torque, or another one)? Because if you have to ask these questions, then implementing such an animation system will probably be a bit too much for you for now. Besides, using an engine saves you a lot of tedious work anyway.
Of course, it can be educative to write such a system, but if your goal is to write a game, then you'd better spend your time writing your game, rather than trying to reinvent the engine wheel. I once wrote a basic OpenGL driven renderer (non-optimized and all) and a half-finished model loader. Recently, I built a scriptable game using an existing 3D engine. Granted, the latter took me about twice as long, but the result was far more than twice as good.
Of course, it can be educative to write such a system, but if your goal is to write a game, then you'd better spend your time writing your game, rather than trying to reinvent the engine wheel. I once wrote a basic OpenGL driven renderer (non-optimized and all) and a half-finished model loader. Recently, I built a scriptable game using an existing 3D engine. Granted, the latter took me about twice as long, but the result was far more than twice as good.
Quote:Why don't you use an existing engine
right, why not!
but I still don't know how does it works.
my earlier question:
Quote:If I want to make my monster run I must make animation in 3ds max and then write in e.g. C++ some code to import and start this animation?
Or I import only 3D model and all animations: running, sitting etc. I must write in C++ (I think it would be very laborious but I'm not sure whether first or second or some other version of creating animations in game is true... so I ask:)
So i make animations in 3ds max and then run it due to C++ code or I write animations in C++?
is very important for me;)
and tell me what does that engine (like ogre, irrlicht or sth like that) makes to help me programming?
There multiple way of animating models; morphing, stitching, but most game use skinning. You know in Max you can add a skeleton (biped etc) and skin the bones to your mesh using a modifier so you can animate it. Once it's done you need a format to export to, most standard format don't export animation so games usually create their own (quake md2/md3, half-life mdl, etc). Then in the game engine reload it recreating a bone hierarchy and bone manipulation who modify the skin just like max. It's a complicated concept (most games company have a programmer who is specialized on animations). That's why Captain P recommended a already existing game engine with already existing model loading and animating code.
1.
So when You make animations? In 3ds max and then You import it to game and start it in proper time? Or You animate it using code? (e.g. right arm 10px to the right?:P)
2.
You mean 3ds max format doesn't export animations?
So when You make animations? In 3ds max and then You import it to game and start it in proper time? Or You animate it using code? (e.g. right arm 10px to the right?:P)
2.
Quote:most standard format don't export animation so games usually create their own
You mean 3ds max format doesn't export animations?
Quote:most standard format don't export animation
That depends on what you think a standard format is.
Quote:In 3ds max and then You import it to game and start it in proper time?
Yes. You export .3ds file. Many game engines natively import .3ds files. You can write your own importer. You can find converters into formats that game engine will accept.
For example XSI can natively export .x files, .collada files, .fbx files, all contain animation info.
I've always found the process of getting the data into your engine to be the hardest part. Once it's there, implementing a animation system isn't so bad. You can do most of it in a vertex shader. As mentioned above, the way you usually do it is write your own intermediate file format and exporter, which takes a lot of time. As luck would have it, there is this great new technology out there called Collada (www.collada.org). Collada is an open source XML based intermediate file format which most major DCC packages (3DS Max included) can export. Collada features full surface description (geometry data, transform hierarchy, shaders, textures) as well as animation, skinning, physics, lights, and arbitrary user data. Using the Collada Document Object Model (DOM), you can extract data from a Collada file quickly and easily, then load that data into your engine's own structures.
So here's how it would work:
Export Collada from Max -> Convert Collada data to proprietary data using the DOM -> Use converted assets at runtime
So here's how it would work:
Export Collada from Max -> Convert Collada data to proprietary data using the DOM -> Use converted assets at runtime
Thank You! :)
so animations are made in 3ds max and then exported with model? (in the same file or other?)
and one more question about own file formats.
As You said, some games have own file formats for models... So where do programmers make this models?
Is it made in 3ds max and exportet to model.max and then somehow converted into md2/md3 (for quake) format?
so animations are made in 3ds max and then exported with model? (in the same file or other?)
and one more question about own file formats.
As You said, some games have own file formats for models... So where do programmers make this models?
Is it made in 3ds max and exportet to model.max and then somehow converted into md2/md3 (for quake) format?
Yep, since a convertor is a lot easier to write than a full modelling package, that's what most people do: they use an existing tool and write their own convertor. And yep, animations are created in a modelling package - hardcoding them would be extremely tedious.
Take a look at existing games if you want to get more comfortable with the process. Many games nowadays come with modding tools, like level-editors and a wide range of conversion tools for model and texture formats. I'm sure that it'll give you a better insight.
Take a look at existing games if you want to get more comfortable with the process. Many games nowadays come with modding tools, like level-editors and a wide range of conversion tools for model and texture formats. I'm sure that it'll give you a better insight.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement