Change 3D models in-game

Started by
4 comments, last by 3DRTcom 16 years, 8 months ago
This post is a bit tricky because it involves both the modeling side and the programming side of creating a game. I have done animations for a long time and I know theres a boxy way of doing it and then its the skeleton way witch enables much more lifelike animations. But in my game I need to be able to change parts of my character when a new type of item is applied on the character or if a chest armor part is changed to another for example. I have bin avoiding to make my own 3D format so far and I use .X at the moment. So my question is how do game makers enable this type of changes to a character in-game and what type of animations do they use? Cause skeletons are just applied to the mesh witch contains the skeleton and would not know what to do if you delete a part of it and change to another mesh part. And if you use the old box animations were you split up the mesh in L_Arm, R_Arm and so on you will get an enormous glitch when the characters waste is rotated one way and the legs still in the same spot.
Advertisement
What I do is make each piece of armor and just place it in the world around the model I want.

Umm...I hope that made sense...let me try again.

If I have human model A, and want to put glove B around his hand, I will say to keep the glove around the model in such a way that the glove looks like it is on him. I can do this in the code or through a file.

But I am still working on 3D programming so there is probably a better way then that.
Quote:Original post by Shlaklava
But I am still working on 3D programming so there is probably a better way then that.
Segment your model, and swap out the hand model with the glove model.

.X sucks for this stuff because AFAIK the skeleton and animation is all contained within one file. So it doesn't work well for the technique I'm about to tell you.

I won't get into how your models should line up and whatnot, but you'll want a common seam so you can swap things in and out (for examples, the seam for the hands will be the same regardless of the actual item, so they can match up with any arm). Ideally, you would want your "skeleton," that is, the bone and animation data, as the thing that receives all the logical control and whatnot. Each of your model files (armNaked, armMaille, handNaked, handGlove, etc) contain the model information (vertices, UV's, faces, etc.), and skinning information (vertex X has .6 weight to bone Y and .4 weight to bone Z, etc.).

Now all you need to do is assign models to that 'skeleton' and they should be seamless and swappable. My game did something like this using OGRE, and logically it makes sense and is pretty clear. Using .X, however, you will have to figure out something far less clean, such as having all models with all animation info (gigantic .X file sizes) and just 'grouping' them to a certain 'character' or entity.
-------------www.robg3d.com
Very good info from all of you, I just have a few questions about the last post.
.X I feel is a bit limited but I have not wanted to change it because I'm a bit scared it will screw up the rest of my engines code for VBuffer and IBuffer. But besides using Ogre or Irrlicht what file type would be the best to do the models in? I mean so I can keep file size down but make these changes and also is easy to find a way to read in the engine. (The best would be a tutorial on how to load a certain file type cause I still don't have full understanding of what the 3D engine does in some parts.)
To solve this you really need to design character right. To separate character on logical parts you want to be changed. Rig them separately and load as separate files.
So lets say you have a naked animated body in .X format and each piece of armor you add to it should be saved as a separate .X format object.
In the end you load body-01, armor-01, headpiece-01.
Everything above sounds easy. The most hard and tricky part is to design the character right, so all the pieces work well together.
So 90% of hard work goes for artist.

This topic is closed to new replies.

Advertisement