Morph Animations in Blender

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
Tools used in this tutorial

Required

The Background Info[edit | edit source]

First, some of you may already know about the method of making morphs mentioned here..:

Making Animated Accordion Pleats

..with the above forum thread by, Vince Bly, linking to this tutorial..:

Andy Dolphin's Shape Key Tutorial

The above method works well enough, but things can get messy if you need to morph more complicated meshes such as “organics” (like human/creature faces, etc) and/or do a fair number of morphs, even complicated morphs at that. Also, the above method limits you to the “Edit Mode” of Blender, and you can't use the “Sculpt Mode” to more easily move around vertices/faces of “organic” meshes.

The below second method, that I found out about, has more pros to it, and virtually no cons..:

Pros[edit | edit source]

  • Allows for use of “Sculpt Mode”, for easier modeling of organic shapes.
  • You don't have to worry about accidentally deleting one or more “shape keys” under the Blender “Shapes” tab, therefore having to start all over again with making the morphs' pose(s) from scratch.
  • You can change your mind later and alter a posed section on a mesh to be different, without having to redo all of the mesh's posed sections all over again (Example: you don't have to alter your mouth's pose, but can alter those flaring nostrils, without having to remake the mouth pose).
  • You have side-by-side visual references next to the original mesh, that each pertain to a different morph pose.
  • This second method is more like how 3DS Max does morphs, so it's more user friendly for users of such program, whom also happen to use Blender.
  • And maybe more....

Cons[edit | edit source]

  • I honestly can't think of any right now, except for extraneous shapekeys that are often created in using this method, but they are easy and quick to clean up.


The Actual Blender Morph Tutorial[edit | edit source]

Beginning Preparations[edit | edit source]

  1. Start with a finalized mesh that you don't need to add/subtract any vertices/edges/faces to.
  2. Do the following in “Object Mode” in Blender: (A) select the finalized mesh (the “original” mesh) and “CTRL +A” on it and choose “Visual Transform to Objects Loc/Scale/Rot”. (B) Make duplicates of this original mesh (SHIFT + D) (I always make duplicates using only the original mesh, and not duplicates of a duplicate, fyi). Make one duplicate for each different morph pose you want to do. Line the duplicates up next to and beside the original mesh, each duplicate having it's own different spot in 3D render window.
  3. On each duplicate, use either the “Edit Mode” or “Sculpt Mode” to give each duplicate a different pose. DO NOT ADD OR SUBTRACT VERTICES, EDGES, OR FACES FROM THE DUPLICATES, NOR FROM THE ORIGINAL MESH – THIS IS IMPORTANT! You only want to move vertices, edges, and faces around – that's all. If you don't heed the warning above, your morphs might end up not working, or at least not work correctly.

Animating Pre-Preparations[edit | edit source]

  1. When all duplicates have been posed to satisfaction, go to your “User Preferences” window type/bar (usually at top of Blender screen, unless you moved it). Go to the field there that says “SR:2 – Model”, and select “SR:1 – Animation” in its place. After this, make sure you have the “editing” panel button selected (F9) under the “Buttons Window”. You should see a tab that says “Shapes” somewhere on there. If so, you're in the right spot.
  2. In the “Timeline Window”, choose your desired “End” timeframe. Remember that 30 frames = 1 second, in TES4: Oblivion. Be sure to set your frames-to-seconds ratio to 30:1. To check and do this, go to the “Clock” icon window → Playback → click on Set Frames/Sec → make sure the # next to “FPS” says 30....if not, change the number to 30, then click “OK”. The thing with the “Clock” icon window, is that you need to decide first exactly how long you want your animation to be, then add one extra single frame to the “End” timeframe field that is to the right of the Clock icon. If your animation needs to be exactly 1 second, hence 30 frames long...you need to make the frame value a 31, and not 30. If you don't do this, and leave the value at 30, you'll get .9667 seconds and not 1.000 seconds, in all areas of your exported mesh or pure kf animation. Otherwise, if you set the value to 31, all areas will export with 1.000 seconds properly, except for the NiTextKeyExtraData's “End” timframe Value field. But this is easy to fix in Nifskope – just change the “End” value of .9667 to a 1.000. Be sure that in the NiTextKeyExtraData in Nifskope, that the timeframe of zero says “start” under it, to right of the “Value” field; make sure that the last timeframe says “end” under it to the right of the “Value” field. Save the kf, and you've fixed it. You have to add that extra single frame to the “End” timframe in Blender, because Blender has the “Start” field value set to timeframe of 1, and not timeframe of 0 (zero)....so you need to offset how Blender “starts” with an extra single frame.
    Look at the two pics attached to bottom of this post, for setting Frames/Sec. Notice the "End" timeframe of "31" - this will give you exactly 1 seconds worth of exported animation, and not something like ".9667" seconds...
    Take into account the number of morph poses you have, and allow enough time to at least space each duplicate equal frames apart. You don't have to do it this way, but I find it helps sometimes.
  3. Make sure to split the Blender render screen up so that you can assign one part of the screen to the “Action Editor” window type. Under that, for morphs, choose “ShapeKey Editor” in the dropdown field. This will allow you to see, visually and with yellow diamonds, at what timeframe each morph pose is at (I find that the “Timeline Window”'s time bar does not visually mark where a shapekey is at..). Also, under “Action Editor” window, you have options to move and duplicate morph shapekeys to different timeframes, after you've initially created a shapekey for each pose (which is done later in this tutorial).

Animating – aka Adding the Morphs to Original Mesh[edit | edit source]

  1. Now we add the poses of our duplicate meshes, to be all condensed into the original mesh! FUN!!! - In “Object Mode”, select the original mesh first, then while holding down “SHIFT” key, rightclick also on a differently posed duplicate of your choice so that you have both selected. The sequence you click on them matters! Without unselecting the two meshes & without selecting more objects, go into “Edit Mode”. Go to “Mesh” → “Scripts” → “Deformed Mesh to Rvk”.....
    I found one issue with your tutorial. When you first click on the object to be morphed, then a deformed duplicate, switch to edit mode and invoke the Deformed mesh to Rvk script, you are asked if you want to make a shape key, as you describe in Step 7 (this probably actually refers to step 8, -Koniption). However, when you go back to Step 7 (again, is probably step 8, -Koniption) the second time and repeat these steps, you are not asked if you want to create a shape key. So the procedure works, but you might want to note that you won't be asked after the first time through, although new shape keys will be generated. I used your procedure to create a waving flag with 7 keys. It worked fine! :)
    
    Vince Bly
  2. On first pop-up: “Second Object Must Have At Least a Shape Key.” You should choose: “Add One?”
  3. On second pop-up: “Do you want to replace or add vertex groups?” You should choose: “No?”
  4. On third pop-up: “Do you want to copy at a new frame?” You should choose: “Yes?” Then enter the frame number you want the pose to happen at, on the fourth pop-up. The pop-ups will keep coming, so after you enter the frame number, move the mouse cursor away from the pop-ups until they go away or otherwise disappear.
  5. Sometimes, the second pop-up is something about armatures..I just click “OK” to go on past that pop-up. I think it appeared because it had to do with me doing animating in same Blender file, that wasn't morph related.
  6. Go back to “Object Mode” and select the original mesh only.You'll see that under “Shapes” tab that it has had at least two shapekeys added: “Basis” & “Key 1”. However, oftentimes, this method also adds extraneous and unwanted shapekeys. So go to any shapekeys after “Basis” and “Key 1” and delete those now, by using the left/right arrows under the “Shapes” to cycle through the keys and delete the odd ones by clicking on the “x” next to them. I usually end up with no more than one or two unwanted keys, so it's quick to clean these up.
  7. Go to “Key 1” under “Shapes” tab and make sure to drag the slider bar to 1.00 while you're at the timeframe you chose in the pop-up window for that particular morph pose. Then, go to timeframe of 1, and slide same slider to 0.00. When you drag the timeline bar slider in the “Timeline Window” from timeframe of 1 to timeframe of the new pose, you'll see the mesh visually animate in the render screen.
  8. Repeat this procedure starting with “Step # 7” through “Step # 13” for the other posed mesh duplicates. After each of these procedures, a new morph pose will be added to the original mesh, under a different key. Be sure to delete any extraneous shapekeys that appear after each procedure, before proceeding to next procedure for each morph pose. If you have an original mesh and three duplicates with different poses on them, you basically only want a “Basis”, “Key 1”, “Key 2”, and “Key 3” - or four keys total, one for each mesh.

To Export[edit | edit source]

  1. When all morph poses are added and animation is to your liking, make a backup save of your Blender scene now. After saving, delete all the duplicate meshes, BUT DO NOT DELETE THE ORIGINAL MESH! You'll see that after this, the original mesh still animates in the render screen even without the duplicates.
  2. Select the original mesh in render window. Export it as “nif/kf” and choose “Export Geometry + Animation”, then export again as “Export Animation Only” and make the name of this second export the name of a valid Oblivion Playgroup animation, such as “Forward”, “Backward”, etc. (Look up “AnimGroups” and “Playgroup” on the TESIV modding wiki).
  3. The exported “nif” version will animate in Nifskope visually...the second exported “kf” version can be used to add animation controllable via scripting's “Playgroup” command to a NiControllerManager block within the same morph animated nif (like the “meshes\dungeons\root\interior\misc\membraneportal.nif” that comes with Shivering Isles expansion), or to add to a pure kf for an NPC or creature animation (like how the Oblivion dog/wolf heads are animated). Here is a small morph export and post-export tweaks Pictorial (picture tutorial), with other related files (Blender scene, sample nif, sample kf, and documents): Morph Exporting Pictorial

Post Export / Misc[edit | edit source]

Most times, you're going to need both the exported morphing nif and it's purely exported kf version. The only time you need to export only the morphing nif version, is if you plan for the morph animation(s) to loop continously in the game. In that case, set the “Flag” to a value of 8, in the NiGeomMorpherController in the nif in Nifskope, so that the animation loops (also be sure to add a BSXFlags set to a value of 11, under the NiNode 0 (Scene Root), else the looping animation won't play at all in the game).

Otherwise, look at the dog/wolf head nif and an associated kf file for that creature that utilizes their morph animations in their head nif (such as specialidle_howl.kf). You can attach the kf animation into the same morphed mesh's nif, to make a NiControllerManager appear. To do this, go to “Spells” → “Animation” → “Attach.kf”, and then browse to and select the exported kf you did for the morph. After attaching the kf to the morphing nif, you'll need to fix certain fields in the animation data, since they'll point to wrong block types here and there. Again, look at the above mentioned “membraneportal.nif,” if you have Shivering Isles, to see how the fields are setup and what they are attached to.

(To get you started: the NiControllerSequence, under its expanded “Controlled Blocks” section... the “Controller” field should point to the NiNode number value in Nifskope that is assigned to the actual mesh's NiGeomMorpherController, and not the NiMultiTargetTransformController that it automatically defaults to. Also, under the NiTriStrips/Shape of the morphed mesh, you want to expand the NiGeomMorpherController & delete all NiFloatInterpolators and their NiFloatDatas, and insert and hook up NiBlendFloatInterpolators in their place - one NiBlendFloatInterpolator for each NiFloatInterpolator. After you do this, the mesh will not animate visually in Nifskope, but the mesh will animate in the game after the appropriate “Playgroup” scripting function is called. This way, you can command the animation(s) at your whim, if need be.)

Exporting[edit | edit source]

There are three different ways that morphs can be setup/exported, for Oblivion (note that Blender cannot currently export morphing nif with built in NiControllerManager, this may change in the future):

  1. Kf only, that includes morphs, with or without bone transforms also in the Kf. (like to control creature "head" nifs that morph)
  2. Exported Nif with the built in morphs and that animates, but WITHOUT built in NiControllerManager/NiControllerSequence in the nif (like for the actual creature "head" nifs themselves <bear, wolf/dog,etc>..)
  3. (I've seen the creature heads set up all sort of ways, with the various "float" related data - some use only the NiBlendFloatInterpolator under the NiGeomMorpherController, some use the NiFloatInterpolators WITHOUT a NiFloatData under them, some use both NiFloatInterpolators with NiFloatData under them....basically it seems that despite which of the various setups, it's ultimately the separate Kf that is exported and that references the morph data for those head, that controls how and when the head moves in the game. Despite, I recommend all such head/creature nifs to have the following in the NiGeomMorpherController: flag of 12, start time "0", and stop time "0")
  4. Exported Nif with the built in morphs, but WITH the built in NiControllerManager/NiControllerSequence in the nif, so it can be controlled via scripting's "Playgroup" command. ( like in Shivering Isles' membraneportal.nif <meshes\dungeons\root\interior\misc\..> )
  5. (These are usually for non-actor stuff. The membraneportal.nif uses "NiBlendFloatInterpolator", in place of the "NiFloatInterpolator/NiFloatData", directly under the NiGeomMorpherController that is directly attached to the NiTriStrips or NiTriShape. But it uses the actual "NiFloatInterpolator/NiFloatData"s that normally would have gone directly under that NiGeomMorpherController, under the NiControllerSequence(s) instead, to control how the mesh animates via script.)

Further information and questions[edit | edit source]