Difference between revisions of "Blender/Custom Creature"

1,632 bytes added ,  10:05, 15 August 2009
Important update regarding bone orientations and animation issues
imported>ShadowDancer
m (typo)
imported>TheMagician
(Important update regarding bone orientations and animation issues)
Line 29: Line 29:




As we add each bone we need to perform specific steps. First we need to name the bone. With our first bone selected, under Armature Bones rename the bone to Bip01. MAKE SURE THAT Bip01 IS THE EXACT NAME! Secondly we need to adjust the bone to fit the mesh. However, since bip01 is a special bone that controls how far along the x and y axises the mesh moves it needs a special orientation. In front view grab the top of the bip01 bone and move it so that the bone extends from the origin straight to the right along the x axis. Hold ctrl so that you know it is exactly on the x axis. Make it end 1-3 units along the x axis.
As we add each bone we need to perform specific steps. First we need to name the bone. With our first bone selected, under Armature Bones rename the bone to Bip01. MAKE SURE THAT Bip01 IS THE EXACT NAME! Secondly we need to adjust the bone to fit the mesh. However, since Bip01 is a special bone that controls how far along the x and y axises the mesh moves it needs a special orientation. In side view (Num3) grab the top of the bip01 bone and move it so that the bone extends from the origin straight to the right along the y axis. Hold ctrl so that you know it is exactly on the y axis. Make it end 1-3 units along the y axis.




Now to add our second bone. Our second bone is the Bip01 NonAccum bone, and it is another special bone. It controls the height and position of the mesh without actually controlling movement as the Bip01 bone does. For instance, when you knock a person down they fall backward, but will get up in the same spot as they fell from. The Bip01 NonAccum bone controls the mesh without changing it's position so it will get up in the same spot. Okay. We need the Bip01 NonAccum bone to start in the same place as the Bip01 bone started, so again move the cursor to 0/0/0. To add a bone in edit mode you simply push space->add->bone and the game will add the bone at your cursor. Once you have added the bone adjust the end of the bone by grabbing it in edit mode and make it end close to the bottom of your mesh. Finally, you need to make your bone a child of the previous bone, in this case Bip01. In the editing panel Armature Bones box with the Bip01 NonAccum bone selected set "child of" to Bip01. This makes it so that when animating when Bip01 moves, Bip01 NonAccum will move as well. However, Bip01 NonAccum doesn't have control over Bip01. ALL BONES must be linked to a previous bone except Bip01, the starting bone.
Now to add our second bone. Our second bone is the Bip01 NonAccum bone, and it is another special bone. It controls the height and position of the mesh without actually controlling movement as the Bip01 bone does. For instance, when you knock a person down they fall backward, but will get up in the same spot as they fell from. The Bip01 NonAccum bone controls the mesh without changing it's position so it will get up in the same spot. Okay. We need the Bip01 NonAccum bone to start in the same place as the Bip01 bone started, so again move the cursor to 0/0/0. To add a bone in edit mode you simply push space->add->bone and the game will add the bone at your cursor. Once you have added the bone switch to side view (Num3) and adjust the end of the bone by grabbing it in edit mode and extending it straight along the y axis. It will occupy the same position as the Bip01 bone, so make sure you make it a little larger so that it is easy to select either bone. (When looking down on your armature from top view, both bones should point straight up along the y axis.) Finally, you need to make your bone a child of the previous bone, in this case Bip01. In the editing panel Armature Bones box with the Bip01 NonAccum bone selected set "child of" to Bip01. This makes it so that when animating when Bip01 moves, Bip01 NonAccum will move as well. However, Bip01 NonAccum doesn't have control over Bip01. ALL BONES must be linked to a previous bone except Bip01, the starting bone.


<blockquote>'''Note''': The Bip01 and Bip01 NonAccum bones are special because they control the location and orientation of your mesh in game. The Bip01 is responsible for locating your mesh along the x and y axis, and controls your creature's location during movement animations. It also controls the orientation of the mesh (the direction your creature is facing) in game. The Bip01 NonAccum is responsible for locating your mesh along the z axis (elevation) and holds the z rotation data for animated rotations. If your Bip01 and Bip01 NonAccum bones are not properly aligned you will end up with incorrect values on export and your mesh will appear strangely rotated and/or sunk in the ground. If your animations suffer from strange elevation and rotation issues, make sure that these bones are both located at the origin (0,0,0) and correctly oriented to point along the positive y axis.</blockquote>


This is a good chance to introduce a useful hotkey. When you need to see inside your mesh just push z to switch to wireframe mode, and z again to go back to solid mode.  
This is a good chance to introduce a useful hotkey. When you need to see inside your mesh just push z to switch to wireframe mode, and z again to go back to solid mode.  
Line 60: Line 61:


3. Shield: similar to the weapon bone, only in the other hand. Keep in mind the weird orientation of the shield handle. If you attempt to add a shield bone check out how the handle is oriented to the rest of the shield by saving, ctrl x, import a shield and look at orientation of the handle. The handle matches the bone.
3. Shield: similar to the weapon bone, only in the other hand. Keep in mind the weird orientation of the shield handle. If you attempt to add a shield bone check out how the handle is oriented to the rest of the shield by saving, ctrl x, import a shield and look at orientation of the handle. The handle matches the bone.
4. Torch: similar to weapon/shield.
4. Torch: similar to weapon/shield.
5. Quiver: Should be on the back facing down.
5. Quiver: Should be on the back facing down.
6. Side/backweapon: only for humans I think.
6. Side/backweapon: only for humans I think.


Now you have the skeleton that will control your animations. Hoorray! Go the Pose Mode and try selecting and moving ONLY the Bip01 bone. Make SURE that all bones move with it. If some don't move you forgot to make them a child of some other bone. In object mode press Ctrl->A and choose "Scale and Rotation to Object data". This will make sure that you didn't accidently mess something up outside of edit mode. Now select Bip01 and make sure its Roll is 0. MAKE A NEW SAVE
Now you have the skeleton that will control your animations. Hoorray! Go the Pose Mode and try selecting and moving ONLY the Bip01 bone. Make SURE that all bones move with it. If some don't move you forgot to make them a child of some other bone. In object mode press Ctrl->A and choose "Scale and Rotation to Object data". This will make sure that you didn't accidentally mess something up outside of edit mode. Now select Bip01 and make sure its Roll is 0. MAKE A NEW SAVE




Line 108: Line 112:




Now we are going to create the collision shapes for our mesh. However, these probably aren't what you are thinking. These shapes only control how your creature will act when knocked down/unconcious/dead. In other words how its ragdoll physics work. In combat they play no part. Each creature actually has a simple capsule mesh that controls whether or not it gets hit or runs into a wall, etc.
Now we are going to create the collision shapes for our mesh. However, these probably aren't what you are thinking. These shapes only control how your creature will act when knocked down/unconscious/dead. In other words how its ragdoll physics work. In combat they play no part. Each creature actually has a simple capsule mesh that controls whether or not it gets hit or runs into a wall, etc.




Line 121: Line 125:




The next step is to tie this object to the specific bone. To do so, first select your armature and go to pose mode. Now select your object->shift->rclick the bone. If you select the armature you weren't in pose mode at the start. Ctrl->p->Bone to make the collision object the parent of this bone. Now create an object for each of the bones that make up the major parts of your mesh. You don't need an object for each finger, etc., however if you DON'T create an object for a bone and it's in a chain without an object further down it's bone chain then it won't have any animation to inherit once the creature is dead. This is an issue because after death it will keep playing the same animation it was playing last over and over again. This means if the animation was curling the fingers on the hand into a fist, the creatue will do that over and over again. Whether that will look appropriate is up to you. However I recommend only making objects for major body parts as ragdoll physics can be VERY taxing on even the best systems.
The next step is to tie this object to the specific bone. To do so, first select your armature and go to pose mode. Now select your object->shift->rclick the bone. If you select the armature you weren't in pose mode at the start. Ctrl->p->Bone to make the collision object the parent of this bone. Now create an object for each of the bones that make up the major parts of your mesh. You don't need an object for each finger, etc., however if you DON'T create an object for a bone and it's in a chain without an object further down it's bone chain then it won't have any animation to inherit once the creature is dead. This is an issue because after death it will keep playing the same animation it was playing last over and over again. This means if the animation was curling the fingers on the hand into a fist, the creature will do that over and over again. Whether that will look appropriate is up to you. However I recommend only making objects for major body parts as ragdoll physics can be VERY taxing on even the best systems.




Line 127: Line 131:




Once you have created these objects it's time to link them together. Without links they will act as seperate bodies and fall apart. This is what happens to the storm atronoch when he dies! However, it isn't appropriate for most creatures, so we have to recreate the skeleton's movement as best we can. There are a number of constraints we can put between objects that will limit their movement. The ones Bethesda used for their skeletons are outlined on this page: http://niftools.sourceforge.net/wiki/Oblivion/Oblivion_Bhk_Constraints
Once you have created these objects it's time to link them together. Without links they will act as separate bodies and fall apart. This is what happens to the storm atronoch when he dies! However, it isn't appropriate for most creatures, so we have to recreate the skeleton's movement as best we can. There are a number of constraints we can put between objects that will limit their movement. The ones Bethesda used for their skeletons are outlined on this page: http://niftools.sourceforge.net/wiki/Oblivion/Oblivion_Bhk_Constraints


Blender can only create two of these constraints, the bhkLimitedHinge Constraint and the bhkRagdoll Constraint. Basically, we will use the limited hinge for hingelike joints like a leg that only rotates on one axis, and the ragdoll constraint for everything else. To create these constraints select the object that is FURTHER DOWN the creature's armature hierarchy. For instance, if we have an upper and lower leg, each with an object, in Object Mode select the object linked to the lower leg. Go to Object View (F7) and in the Constraints box choose Add Constraint->Rigid Body Joint. You can choose either Ball or Hinge. Ball is for the ragdoll constraint and hinge is for the limited hinge constraint. Now in the toObject box type the exact name of the other object this object is linked to. For instance, if this one is named box 5 and the one for the upper let is named box 4 type box 4. Press enter and the red box should go away. This is all the detail we can achieve in blender for each joint, so link each object together to recreate the armature hierarchy, starting at the farthest from Bip01 and going inward.
Blender can only create two of these constraints, the bhkLimitedHinge Constraint and the bhkRagdoll Constraint. Basically, we will use the limited hinge for hingelike joints like a leg that only rotates on one axis, and the ragdoll constraint for everything else. To create these constraints select the object that is FURTHER DOWN the creature's armature hierarchy. For instance, if we have an upper and lower leg, each with an object, in Object Mode select the object linked to the lower leg. Go to Object View (F7) and in the Constraints box choose Add Constraint->Rigid Body Joint. You can choose either Ball or Hinge. Ball is for the ragdoll constraint and hinge is for the limited hinge constraint. Now in the toObject box type the exact name of the other object this object is linked to. For instance, if this one is named box 5 and the one for the upper let is named box 4 type box 4. Press enter and the red box should go away. This is all the detail we can achieve in blender for each joint, so link each object together to recreate the armature hierarchy, starting at the farthest from Bip01 and going inward.
Line 145: Line 149:




Once that's done it's time to adust our constraints. First in the Render menu make sure that everthing but Show Hidden is checked. In the render window we should now be able to see our collision objects as spheres or capsules. Inside of each capsule we can see our constraint as either a cone or a little circle. Cones are ragdoll constraints and circles are limited hinge constraints. The first thing to do is to adjust the pivot point of each a constraint to the bone joint. To do so select a constraint (click it), then in the Block Details window expand the Ragdoll or Limited Hinge block.
Once that's done it's time to adjust our constraints. First in the Render menu make sure that everything but Show Hidden is checked. In the render window we should now be able to see our collision objects as spheres or capsules. Inside of each capsule we can see our constraint as either a cone or a little circle. Cones are ragdoll constraints and circles are limited hinge constraints. The first thing to do is to adjust the pivot point of each a constraint to the bone joint. To do so select a constraint (click it), then in the Block Details window expand the Ragdoll or Limited Hinge block.
For a Ragdoll Constraint I recommend setting Pivot A to 0/0/0, Plane A to 1/0/0, and Twist A to 0/1/0. This is a simple setup that will limit bone's rotation to about 115 degrees in any direction perpendicular to the bone's current orientation. Now right click Pivot B and choose A->B. Confused yet? Hope you remember (or at least heard of) radians from high school. Basically instead of degrees of rotation .nifs use radians. So instead of 360 degrees there are 3.1415926535 (ie. pi) radians of rotation possible. DO NOT enter a number above 3 (excluding friction and pivots) or it's likely nifskope will crash. If you don't want your joint to feature 230 degrees of rotation then you need to lower the last five entries above Max Friction. To keep it simple I recommend just entering equal values like .4 or .2 for each and looking at how it effects the constraint. Or you could take a look at this page and try to figure it out: http://niftools.sourceforge.net/wiki/Oblivion/Oblivion_Bhk_Constraints
For a Ragdoll Constraint I recommend setting Pivot A to 0/0/0, Plane A to 1/0/0, and Twist A to 0/1/0. This is a simple setup that will limit bone's rotation to about 115 degrees in any direction perpendicular to the bone's current orientation. Now right click Pivot B and choose A->B. Confused yet? Hope you remember (or at least heard of) radians from high school. Basically instead of degrees of rotation .nifs use radians. So instead of 360 degrees there are 3.1415926535 (ie. pi) radians of rotation possible. DO NOT enter a number above 3 (excluding friction and pivots) or it's likely nifskope will crash. If you don't want your joint to feature 230 degrees of rotation then you need to lower the last five entries above Max Friction. To keep it simple I recommend just entering equal values like .4 or .2 for each and looking at how it effects the constraint. Or you could take a look at this page and try to figure it out: http://niftools.sourceforge.net/wiki/Oblivion/Oblivion_Bhk_Constraints


Line 162: Line 166:


You will need at a minimum a forward, fastforward, backward, idle, turn left, and turn right animation. If you want your creature to be able to attack you'll need more, cast spells more, etc.
You will need at a minimum a forward, fastforward, backward, idle, turn left, and turn right animation. If you want your creature to be able to attack you'll need more, cast spells more, etc.
<blockquote>'''Note''': Remember, for movement animations, your Bip01 bone controls the position of your mesh along the x and y axis, and z rotations are exported on the Bip01 NonAccum bone. To turn your creature so that it is facing a new direction, change both the Bip01 and Bip01 NonAccum bones. If you only rotate one bone, you will end up with the character moving in a direction different from the direction they are facing.</blockquote>




Anonymous user