Difference between revisions of "Blender/Custom Creature"

1,633 bytes added ,  08:41, 22 July 2011
imported>ShadowDancer
(wikified internal links, added TOC)
imported>Hashmi
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Introduction==
==Introduction==


To begin I want to say that this process is not for the faint of heart. Creating a creature from scratch probably takes 2-3 times as long as simply rerigging a creature to a vanilla skeleton and retexturing it. However, with that approach you don't have any control over how the creature moves, and it obviously limits creature shape. What if you want a creature with four arms or two heads? Or something that rolls around on the floor? There's simply nothing comparable in total control. And actually making a creature from scratch is very rewarding in my experience. It also brings us one step closer to Bethesda's quality of creatures.
To begin I want to say that this process is not for the faint of heart. Creating a creature from scratch probably takes 2-3 times as long as simply rerigging a creature to a vanilla skeleton and retexturing it. However, with that approach you don't have any control over how the creature moves, and it obviously limits creature shape. What if you want a creature with four arms or two heads? Or something that rolls around on the floor? There's simply nothing comparable to total control. And actually making a creature from scratch is very rewarding in my experience. It also brings us one step closer to Bethesda's quality of creatures.


So sit down, read a little at a time, and don't get dissuaded too easily. I've created a creature following this tutorial and included it as an example as well as my .blend files at various points in the process. They are located at: http://www.mediafire.com/?e5hs2azsvtf
So sit down, read a little at a time, and don't get dissuaded too easily. I've created a creature following this tutorial and included it as an example as well as my .blend files at various points in the process. They are located at: http://www.mediafire.com/?e5hs2azsvtf


==Required Tools:==
==Required Tools==


* Blender: with the .nif plugins
* Blender: with the .nif plugins
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.
 


This process may seem convoluted, but you must follow the steps as best as is possible. Basically we are going to recreate the shape of our mesh using simple shapes centered on individual bones. Begin with your armature selected in edit mode, front view. Select the biggest, most centrally rigged bone and do shift->s->Cursor->Selection. Now your cursor is at the Centre of the bone. Go back to object mode. Press space->Add->Mesh->Cube.


This process may seem convoluted, but you must follow the steps as best as is possible. Basically we are going to recreate the shape of our mesh using simple shapes centered on individual bones. Begin with your armature selected in edit mode, front view. Select the biggest, most centrally rigged bone and do shift->s->Cursor->Selection. Now your cursor is at the end of the bone. Move the cursor to the center of the bone as best you can. Go back to object mode. Press space->Add->Mesh->Cube. Go to Edit mode. Adjust the cube's shape, size, and orientation so that it roughly covers the area assigned for this bone's vertices. It should be a little bigger than the part of the mesh controlled by this bone. DO NOT RESIZE OUT OF EDIT MODE. Now go back to object mode. In the Panels window select Object View (F7). With the square selected in the draw box change the drawtype to Bounds and in the Draw Extra dropdown box to either Sphere or Cylinder, depending on what fits your mesh shape better. DO NOT ADJUST THIS OBJECT AGAIN.
In the Panels window select Object View (F7). With the square selected in the draw box change the drawtype to Bounds and in the Draw Extra dropdown box to either Sphere or Cylinder, depending on what fits your mesh shape better. Now go to Logic View (F4). With your new object selected choose Actor->Dynamic->Rigid Body and turn Bounds on.
 
In object mode or edit mode, Scale the mesh to fit the bone (do not rotate) and apply Scale Data (Ctrl A - if you do this in Object mode, not required if you scale in edit mode). Next rotate the mesh if it is required in Object mode (DO NOT APPLY ROTATION DATA ... if you need to scale after rotating do so only in edit mode and do not rotate in edit mode.)




Line 117: Line 125:
http://i255.photobucket.com/albums/hh130/kilzaja/Capsulesetup.jpg
http://i255.photobucket.com/albums/hh130/kilzaja/Capsulesetup.jpg


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.


If it doesn't look right create a new object and delete the old one. Now go to Logic View (F4). With your new object selected choose Actor->Dynamic->Rigid Body and turn Bounds on. You'll notice that there is now a little sphere outline inside of your object. This is telling you that your object is set up for physics in the gameworld and that your object is centered on the sphere. Please don't try to edit your object from now on, as it will mess up on export and cause many problems.
You may (and should) also assign the mass to collisio objects within blender. In logic view, change the mass value and also add a new float property named Mass with the value that you want. For a general idea of mass values ... a single human thigh in oblivion has a mass of 45, whereas its first collision object (on Bip01 NonAccum) has a mass of 60. In general masses should decrease from the central object to ends.




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.
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 and every bone (for example fingers) because bones will inherit Physics from other bones, higher or lower in their Heirachy ... remember however that if a bone does not have any Physics data to inherit from then it will keep playing the creature's Idle Animation. Also you don't need an object for special bones like Bip01 or magicNode, because their animations don't matter after creature death ... most bethesda creatures have Bip01 NonAccum as the first bone with a collision object.




You only need an object for parts of your mesh, not the special bones like Bip01 or magicNode, because their animations don't matter after creature death, and Bip01/Bip01 NonAccum inherits from other bones.
Once you have created these objects it's time to link them together. Without links they will act as separate bodies and fall apart. { Depending on how you have segmented and skinned your mesh ... this can lead to two things in game ... for some like the skeleton and Storm Atroanch it will cause limbs to get cut off and fall apart ... for others it will cause ugly vertex distortions.}


If you don't want the collision bodies to fall aprt then you would need to link them together with "constraints". Constraints basically work like Joints, they hold together collision bodies while only allowing limited movement. 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 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
Blender can only create two of these constraints, the bhkLimitedHinge Constraint and the bhkRagdoll Constraint. We will use the limited hinge for hingelike joints like a knee or elbow that only rotates on one axis, and the ragdoll constraint for more free joints like neck, hips, shoulders etc.


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.
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.
 
 
 
You can position
 
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 161:




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 151: Line 167:




The last thing that we may have to fix is the BSBound Box. If it isn't immediately under the scene root then you need to move it up to the scene root. Also, you may have to adjust its size since it isn't a box any more. Heh. WHEH! Save that sucker and get ready for animations! http://i255.photobucket.com/albums/hh130/kilzaja/BSBound.jpg
The last thing that we may have to fix is the BSBound Box. If it isn't immediately under the scene root then you need to move it up to the scene root. Heh. WHEH! Save that sucker and get ready for animations! http://i255.photobucket.com/albums/hh130/kilzaja/BSBound.jpg
 


==Creating Animations==
==Creating Animations==
Line 162: Line 177:


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