Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by bknecht, 18 years ago) (diff)

How to create a md2-Model for Orxonox

Well, to find out, how you manage to create those models was a pain in the ass, I hope that there is a better way in the near future.

Introduction

For a complete md2-model I need at least 3 programs. Unfortunately they're not all open source software: Maya (or Blender (opensource)) to create an object file (*.obj), Milkshape 3D (I'm using version 1.7.8 in this tutorial) to create the animations and export it into the md2-fileformat and Photoshop or anything else to generate good textures. Most of the time Misfit helps to edit animations on existing md2-models.

The problem with the md2-models is, that they save the animation into vertex-movement. This is a problem, because Milkshape doesn't get that and so we are only capabale of editing bone-animations with this particulary program. So we have to save our animation into another fileformat: ms3d.

Be also aware that md2-models only work with moved vertex. You cannot recombinate models during an animation.

Problems with Milkshape

Before doing anything big, you would rather like to check if Milkshape crashes if you try to safe anything into the *.ms3d file format. If it crashes download these two dll-files and put them into the Milkshape directory, this should help you out.

I want to start from scratch

Okay, so you have something in mind which should be animated. Cool, first you will have to model your object or person in Maya or Blender and save it as an object file (*.obj). Do not care about texturing yet, we will have to do this later.

I do have a model now

Start Milkshape and import the object file. Now we want to add animation. With persons or things with joints we're going to need a skeleton. A skeleton is a set of points connected to each other with bones in a child/parent-relationship. We know this with Parent-Nodes in Orxonox. Be aware that every new joint you add, will be a child of the joint which is selected when you place the joint.
When your skeleton matches your model you will have to assign the model's vertex to the bones. Make sure you have chosen the selection tool and that you're able to select vertexes (Be sure you deselect "Ignore Backface").
Change now to the joint-tab (at the right side of the screen) where you can see a list of all the joints you've created. If you want you can change their names (arm, leg, hand…) so you dan't mix them up. Select a joint in this list and then select the vertex which should be part of this limb. Then press "Assign". To check if it worked, use the button called "Sel. Assigned" to see which vertex are part of which joint. Here there is also this child/parent relationship: A vertex which is part of a joint is automatically part of any parent or grandparent of his joint.
Important: Every single vertex must be part of a bone, otherwise the md2-model won't be exported by Milkshape.

I have the model and the skeleton

Animations with skeletons are a lot easier than pure vertex animation. Fortunately Milkshape will convert skeleton animation into vertex animation when we export it, so we don't need to worry about this. Press now the "Anim" Button at the lower edge of your screen. And put in the numbers of frames you want to use in your animation into the box at the right. Let's take something between 15 and 25. It depends how complicated the movement will be. The more complicate the more frames you gonna need.
Be sure you have selected the first frame with the drawer on the lower edge. Now press Ctrl+K or choose "Animate→Set key frame". We will probably only need 5 or 10 key frames in our animation since Milkshape will smooth the animation in the frames between the key frames. To those guys using flash for 2D animations: Milkshape connects all your key frames with motion tweens! Now you go to frame 3 or 4 and start moving and rotating joints. When you think this animation step is finished, press Ctrl+K again and go further to the 6th or 7th frame and move your joints further.
Congratulatons: You just finished your first key frame to key frame 3D-animation.

What's about the texture

Right, almost forgot: In Milkshape it is really easy to add a texture. You will have to select different parts of your model and put parts of the texture on it like in a skin transplant. I will add some tips here if I did texturing myself.

My animation is finished and the model's got its texture

Now we have to export this thing. You will first have to create a file called md2.qc ("Tools→Quake III Arena→Generate Control File") then you should be able to export your animation into the md2 file format ("File→Export→Quake 2 (MD2)"). Important: You cannot edit a md2-file with Milkshape. If you want to edit your animation ever again, save it in the Milkshape file format (*.ms3d).

I have a md2-model I want to edit

Well you're doomed, Milkshape does not allow this.
Just kidding: You will need "Misfit" (opensource) to open, watch and edit the md2-model and all its animations. Here you won't be able to use a skeleton, but you can alter some vertex (frame by frame).