How To Animate A Rig In Blender
Quick and Dirty Guide:
Rigging and Animating a Model,
then Exporting to and Viewing in Ogre
Footstep 1: Create a Model
For more details on creating a model, run across Creating a model in Blender. We will do a very elementary model for this example -- an inchworm! Starting with our friend the initial cube in blender, go to edit manner, switch to face selection, and select whatever face:
Press 'e' (for extrude, you can instead select Mesh->Extrude->Extrude Region from the menu), and movement the extruded face over a chip. Echo until you have a dainty worm. Be sure to extrude your worm in a straight line, we will curve the worm with our animations.
Now nosotros are set up to add together a skeleton, or armature, to apply in animative the object. First, permit's put the selection marker on the worm, by left-clicking in the scene. To place the marker correctly in 3-space, information technology is usually easiest to left click, then chance the view (using the number pads or by mousing around with the middle mouse push) and left click again.
Brand sure you are in object mode (not edit mode), and select add together Add together->Armature->Single Bone
Hmm... we don't seem to see anything. That's because the bone is inside our model. In the outliner (upper right panel by default), select the armature. Then, in the holding console, select the object pane (fiddling cube), scroll downwards to the brandish group, and click Ten-Ray
Now we tin can see the bone. Move it effectually until it is in line with the model. Motion the pointy office of the bone until it is the correct size
We need to apply this transformation. In Object Style, with the os selected, press ctr-a, and apply rotation and scale. This will accept no visible effect in blender, but it will be required for export. Yous can cheque to make certain that the transformation has been practical correctly in the properties pane -- rotation and scale should be zero. (What is going on is this: Blender stores the local position of each vertex &etc in model infinite, and then also stores a transformation matrix for the entire model itself. When bender displays the model, information technology uses this transformation matrix. When information technology exports the model, information technology does non. So, to go the blender visuals to match what Ogre tin see, we utilise this transformation matrix to the model itself.)
Select the "pointy" end of the bone, press 'e' (for extrude), move the mouse to extrude the bone, and press the left mouse push button to when you are washed.
Go along extruding basic until you lot have a nice skeleton inside your worm.
At this point, the armature is not paired to our object. They happen to be close to each other in space, but there is no relationship between them. We need to parent the worm mesh to the armature. Before we do this, nosotros need to make sure that all transformations accept been applied to the mesh. In object way, select the mesh and make sure the rotation, location, and scale are nada. If not, simply press ctrl-a to apply, every bit with the armature. While in object manner, select get-go the mesh (yous can do this in the outliner) and then the armature (shift-click) and parent the object to the armature with automated weights.
When parenting an armature to a mesh, the system needs to know which vertices in the mesh are controlled by which bone. A particular vertex can be controlled by more than than one bone (with unlike bones having a weighted influence). If nosotros were doing this the "correct fashion", we would create vertex groups, and have each bone control a different vertex grouping. (An example of how to do this using an older version of blender tin be establish here. Note that the older version of blender uses an older animation exporter, and animations are handled in a slightly different style) Let's exist lazy and take blender practise information technology for united states of america, using proximity to determine what os controls each vertex.
Select the armature, and and so go to pose manner. Rotate one of the basic to make sure the armature has been applied to the model
In the bottom plane, switch to the Dope Sheet editor
And so switch to the activity editor
Click on the new button to become a new activity
Then click on that same button (now named "Action") to rename it something useful, like "Wave"
Make sure the armature (and all bones!) are selected and we are in pose mode. Then press 'i' to insert a keyframe (or select insert keyframe from the pose carte
Motion the timeline over a few frames -- say, twenty or then, and rotate some of the basic, and insert a new keyframe
Go along until you have a nice animation. When it looks good, then click on the F buttons by the activity proper noun (so that this blitheness will be saved when we articulate it), and then click the 10 button to clear the animation (so we tin can practise another one)
Echo the procedure to create more than animations if yous like. So, switch to the NLA editor
Add a new track
Then add an activity strip
If you have additional animations, add a new track, motility the green animation timeline to the stop of the previous blitheness and add a new animation to the timeline
Scrub the timeline back and forth across both actions, and make certain that they both practise what you want. And so, export everything, and copy the .mesh and .skeleton files to the appropriate locations in the content folder that Ogre can see (I prefer to place both the skeleton and the mesh in the Models folder, but anywhere Ogre can run into them is fine
Now, we are ready to use the animations in Ogre. Create the Entity and scene nodes equally normal. Hither, we are creating two objects then we can show off 2 animations at once
mInchwormEntity = mSceneManager->createEntity("worm.mesh"); mIncrwormNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); mIncrwormNode->attachObject(mInchwormEntity); mInchwormEntity2 = mSceneManager->createEntity("worm.mesh"); mIncrwormNode2 = mSceneManager->getRootSceneNode()->createChildSceneNode(); mIncrwormNode2->attachObject(mInchwormEntity2); Next, go at the blitheness state for each entity, and enable the advisable animations. Yous can accept more than than 1 animation agile for each entity, with unlike weights per animation. We volition be simple and just have a since blitheness per object, that controls it completely
mInchwormEntity->getAnimationState("Inch")->setEnabled(true); mInchwormEntity->getAnimationState("Inch")->setLoop(true); mInchwormEntity->getAnimationState("Inch")->setWeight(1.0); mInchwormEntity2->getAnimationState("Wave")->setEnabled(true); mInchwormEntity2->getAnimationState("Wave")->setLoop(true); mInchwormEntity2->getAnimationState("Wave")->setWeight(i.0); Finally, in the think method for each object, phone call addTime to move the blitheness frontwards
void Earth::Think(float time) { // Practice other stuff Ogre::AnimationState *st2 = mInchwormEntity->getAnimationState("Inch"); st2->addTime(time); Ogre::AnimationState * st = mInchwormEntity2->getAnimationState("Moving ridge"); st->addTime(time); } In-Grade Assignment
Now for the fun part! Creating a model, rigging it, animating it, exporting to ogre. Here's what you should do:
- Create a unproblematic model in Blender. A worm is fine, or you tin can do something more complicated if you like. Keep if adequately simple, I desire to utilise today and Monday to stop this practice completely
- Rig your model. Call back to apply rotation / location / scale to both armature and model, then that the transforms are all 0s!
- In the Dope Canvass, swap to the Action Editor, Create a new activeness strip, proper name it, and create an animation with some keyframes. Move the timeline around to brand sure that everything works
- Bandy to the NLA Editor, add a Track, then add together the activeness you merely created
- Repeat the higher up, so that you lot have at least 2 unlike animations. Exist sure that they don't overlap in the NLA, and scrub through the timeline so y'all can encounter them motion
- Export to Ogre, and get your blithe object to appear. Use the following base project to go started:
- OgreTestbed.aught
- Congratulations! You now know how to create a model, rig it, and animate it!
Source: https://www.cs.usfca.edu/~galles/cs420/lecture/AnimationInBlender/Animation1.html
Posted by: thomascuslichavy.blogspot.com

0 Response to "How To Animate A Rig In Blender"
Post a Comment