Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| player_model_export_guide [2017/11/22 16:29] – created romdos | player_model_export_guide [2017/11/22 16:56] (current) – romdos | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ''// | + | For this tutorial I'll be using f0rqu3's Python export scripts for Blender, found [[http:// |
| + | or [[http:// | ||
| + | |||
| + | I'll assume that you have a basic working knowledge of modeling, animation, armatures, object manipulation, | ||
| + | If you have any issues with these, I recommend checking the official Blender homepage for help: http:// | ||
| + | |||
| + | There are many people around the world sharing their knowledge and experience in using this great 3D tool, so apart from the Blender homepage, there are lots of other pages to find very useful and interesting information, | ||
| + | Just ask me if you have any questions, or if some parts of this article aren't very clear. Let me know and I'll do my best to fix it. | ||
| + | |||
| + | Briefing on Segmentation of Models | ||
| + | |||
| + | Quake 3's (idTech3) player models are segmented. So what does that mean? It basically means they' | ||
| + | |||
| + | What does that mean for a regular player? | ||
| + | |||
| + | * The model can do two actions at the time (e.g. run and shoot, or jump and gesture) | ||
| + | * Parts of the model can rotate separately from each other (e.g. model raises his head when the player looks up) | ||
| + | |||
| + | Usually humanoid models are divided into 3 segments: | ||
| + | |||
| + | * Legs (also referred as ' | ||
| + | * Torso | ||
| + | * Head | ||
| + | |||
| + | The downside of these divisions are: | ||
| + | |||
| + | * Unless connections between body parts are covered with geometry, seams are very visible | ||
| + | * Under some angles, some animations can cause body parts to overlay on each other (e.g. elbows go through knees when model is in a crouching position, and gesturing while looking down) | ||
| + | * They can be difficult to export | ||
| + | * '' | ||
| + | |||
| + | Each model doesn' | ||
| + | |||
| + | You'll need to rig with armature objects. You may have already noticed (by importing MD3 models) that each model has separate animations (the only animations that are synced are death animations). My idea was to make separate armatures for each part of the body, but still connect them using ' | ||
| + | This way, I could animate both upper and lower body animations and animations of both at once (like for the death animations). | ||
| + | |||
| + | Also, I could see the how the animations would look in-game. So how did I put these parts together? | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | //Example locations for some of the empties// | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | Here I've set leg armatures to fit the leg's shape. I made the hip bone the ' | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | This makes the magic bone always keep its original rotation (always pointing up, unless otherwise needed). I added an empty object, and then while in Pose Mode, I first selected the empty and then the ' | ||
| + | |||
| + | The next step was to add an upper body armature in place of where the empty object was. So, I selected the empty and snapped cursor to it, and added an armature. In Object Mode, (making sure that the center of the armature aligned with the empty) I made the armature a child of the empty. | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | Then using Edit Mode, I made the armature fit the model and added a special bone for the head and parented the empty (another one) to that bone for fixing the head. After doing so, I parented the empty object (the one I've just set to be a child of the head bone) to head (the one with a real mesh). | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | (The pink box on the screenshot is also an empty) | ||
| + | |||
| + | What do we have now? | ||
| + | |||
| + | The Lower armature is parented to the Torso' | ||
| + | * The Head empty which is parent for the Head object | ||
| + | * Weapon empty that is parent for the weapon (but that's not necessary, it's just there for animation previews) | ||
| + | |||
| + | Now, parent each armature to the right part of the body (lower to legs, upper to torso) and start weight painting, moving bones around while checking how it distorts topology of the mesh, then fixing it up, and remodeling as needed. | ||
| + | |||
| + | When you feel that you are alright with what you have, take a look into the animation.cfg file to see what animations are needed and then make your own. | ||
| + | Here is the animation.cfg file for Tremulous' | ||
| + | |||
| + | |||
| + | // animation config file | ||
| sex m | sex m | ||
| footsteps custom | footsteps custom | ||
| Line 27: | Line 99: | ||
| 220 10 10 15 // | 220 10 10 15 // | ||
| 230 10 10 15 // | 230 10 10 15 // | ||
| - | 240 7 7 15 // | + | 240 7 7 15 // |
| + | |||
| + | |||
| + | <image missing> | ||
| + | |||
| + | |||
| + | Each of these animations must be done... or at least some of them. | ||
| + | |||
| + | Tips on Animating | ||
| + | |||
| + | |||
| + | * A good way of doing animations is to make actions for every animation (see above) which is extremely useful when putting animations together | ||
| + | * The animations for MD3's start at frame 0, but in Blender they start from frame 1 (note:, so if the BOTH_DEATH1 animation starts at frame 0 and ends at 29 (30 frames), in Blender it would start at frame 1 and end at frame 30. | ||
| + | * For the Torso, the animation.cfg shows the correct frames for animation, but for the legs, after the 'BOTH_DEATH' | ||
| + | |||
| + | In the real MD3 file, the 'legs only' animations start at frame 90, but in the animation.cfg file, we see that it adds 63 frames of 'torso only' animation frames (63 of them) so we start from 153 instead. We end the 'legs only' animations in the MD3 at frame 184, but in the animation.cfg, | ||
| + | |||
| + | The last tip is not important until we get to the stage where we put our animations in order using the NLA editor. | ||
| + | |||
| + | Setting the Model and Exporting It | ||
| + | |||
| + | Before you export, check that your model is the right size, rotation and location. Just import another MD3 player model for comparison. | ||
| + | |||
| + | Add an empty and parent it to our lower armature (Remember that its the ultimate parent of whole model, and everything else is somewhat it's child). First rotate it around the Z-axis so instead of facing towards you in ' | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | You can see the empty in the picture above - its this big cross. Don't freak out, it's still a good old empty, just viewed in a different way and resized. Check the picture below: | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | Now scale up the empty, until you are happy with it. This scaling isn't final, so write down the amount that you've scaled it up (you' | ||
| + | |||
| + | Exporting the Model | ||
| + | |||
| + | 1. Save the .blend file. | ||
| + | 2. Delete the upper armature, torso and head (and all of the empties except the torso' | ||
| + | 3. Save as a new .blend file (give it a new name). | ||
| + | 4. Open up your .blend file saved in step 1, and delete the lower armature, legs, and head (and weapon if you had one). | ||
| + | 5. Make sure that the torso' | ||
| + | 6. Save what you've done as a totally new .blend file. | ||
| + | 7. Once again, open the file from step | ||
| + | 8. This time, delete all but the head's empty and the head parented to it. | ||
| + | 9. Repeat step 5 for the head's empty. | ||
| + | |||
| + | Setting Up Animations | ||
| + | |||
| + | <image missing> | ||
| + | |||
| + | 1. Open the .blend file that contains only the legs. | ||
| + | 2. Import the legs from the basic human model in to another layer. | ||
| + | 3. Split the main 3D window into 3, and press the lock button on the middle one to be able to view 2 layers at once. | ||
| + | 4. Open the NLA editor in a window and start putting animations into the right order, checking against the imported mesh. | ||
| + | 5. In your model, add a new empty and name it as tag_torso . But first, in the imported model, add a character to the end of its empty (like tag_torso_ , because Blender won't let you give two different objects the same name. | ||
| + | 6. Snap it to the torso' | ||
| + | 7. Parent the torso' | ||
| + | 8. Move the torso' | ||
| + | 9. Set the model to its final animation frame: This is the one where the basic human model freaks out and doesn' | ||
| + | 10. Now select every model you want exported and also the newly named tag_torso and export it. | ||
| + | |||
| + | Also, while you're exporting the upper body, remember that you'll need to repeat the process of copying the empties and naming them as tags for the different 3 tags: tag_head, tag_weapon, and of course tag_torso. (check the names from the imported model). | ||
| + | |||
| + | Finally, the little text window that pops up when exporting is the location where the game engine will look for the texture/ | ||
| + | Eg: models/ | ||
| + | |||
| + | Cheers! | ||
| + | |||
| + | Article by Krzysztof ' | ||