Rigging: Blender 2.7+

///Rigging: Blender 2.7+

Rigging with Blender 2.7+

Please make sure you have read Hayden’s article “Exporting From Blender 2.7+ to Skyrim”


(OpusGlass):
This is a collection of all the info I’ve learned about using Blender 2.7 for rigging and exporting rigged meshes. It probably includes a lot of info applicable to working with rigged meshes in general too. I’ve tried to describe most of my workflow and list the common issues that I’ve encountered. I might flesh it out in the future, including screenshots.

Disclaimer: This is just what I did, there might have been new updates that make this unnecessary. But I know this works so I’m sticking with it for a while.

=Software=
Blender: 2.78c
Niftools: 2.6.0 dev 4 (from 6/18/2016)
The modified Niftools files attached to this post
(Note: This is two fixes posted by official dev Neomonkus on GitHub, and one fix of my own for an issue during export after importing multiple Nifs.)
Nifskope

=Install=
1. Install Blender
2. Install NifTools
3. Copy the modified niftool files into the following directory, so they overwrite the originals: %AppData%\Blender Foundation\Blender\2.78\scripts\addons\

=First notes=

  • -As a beginner’s rule of thumb, your mesh needs to be roughly the same shape (and position) as the vanilla model whose skeleton you’re using. With practice, you’ll learn where you can and can’t deviate from the base shape.
  • -You need to work with meshes from Oldrim/Legendary Edition. SPECIAL EDITION MESHES WILL NOT WORK. You can convert your finished mesh to SE format with SSE Nif Optimizer.

=Rigging & Partition notes=

  • -To transfer rigging weights from an imported vanilla mesh to a custom mesh, load them both and make sure they’re both parented to the same skeleton. Then while in Object mode right click the vanilla mesh, then Shift+ right click the new mesh, then go to Weight Paint mode. At the bottom of the Tools section, you will see “Transfer Weights”, run that with these options: Vertex Mapping: Nearest Face Interpolated, Source Layers Selection: By Name.
  • -After transferring weights you can adjust them in Weight Paint mode. You need to have the display mode set to Solid to be able to see these values. Then choose a vertex group in the Data tab to see/edit the weighting of that bone.
  • -If you’re using Normalize or Auto-Normalize when painting weights, you’ll need to first remove all vertices from any Partition vertex groups. Otherwise, the normalization will ruin everything. These groups will be called things like SBP_32_BODY. Use the Data tab to Assign them back to the appropriate groups after you’re done painting weights. If you don’t add them back, the mesh will be exported with a NiSkinInstance instead of a BSDismemberInstance. (Some creatures don’t use partitions, and therefore always have a NiSkinInstance. That’s fine.) For the creatures I’ve worked with, there has been at most 2 partitions, so I just make sure to only weight paint on vertices from one partition (selection masking can help here) at a time so I don’t accidentally put any in the wrong partition afterward.
  • -Sometimes those partitions are split up on an imported mesh, into SBP_32_BODY.002 etc. In those cases, combine them using Assign and delete the numbered groups.
  • -If you get an export error about some faces not being assigned to any partitions, make sure that every face is assigned to the appropriate partition. I’ve only worked with models with up to 2 partitions, but my workflow is: (1) Make sure you’re in FACE SELECT mode in Edit. (2) Go to one of the partitions in Vertex Groups and hit Select. (3) Make sure Weight is set to 1.0, then hit Assign. (4) Go to the other partition and hit Remove. (5) Hover over the model window and hit Ctrl+I to invert the selection. (6) Hit Assign. (7) Go to the first partition, then hit Remove. (If that still doesn’t work, I select the faces from one partition, delete both partitions, recreate them, and then assign the selection to one and assign the inverted selection to the other.)
  • -You’ll get corrupted rigging if the object’s Transform settings are incorrect for that skeleton. You can use Ctrl+A to apply any existing transforms, then go to the Object tab and type in the opposite (negative) of the correct transforms (look at an imported vanilla mesh), apply those, then finally type in the correct transforms to restore it to the correct position with the correct values. Do NOT apply those last correct transforms, just leave them as numbers in the Object tab. If it’s supposed to be all 0’s, just applying the existing transformations will be enough.

=Export notes=

  • -When exporting, be sure to choose Game: Skyrim and Max Partition Bones: 60. I also always check “Flatten Skin” but I don’t know if that’s actually necessary. Otherwise, the default import and export settings have always worked for me.
  • -You can easily run into problems with the settings in the Object tab, Data tab, Material tab, and Texture tab. If you get an error/issue and you don’t know what it is, the best approach is to compare all of the settings in those tabs to a vanilla mesh.

=Nifskope (post-export) notes=

  • -After export, I recommend splicing the vertex data and rigging data into a vanilla nif that uses the same skeleton. They must have the same string name on the Root node, then you can copy the NiTriShapeData and paste at the end, then for the BSDismemberSkinInstance (or NiSkinInstance) copy branch and paste at the end. Remember their new node numbers. Then find the NiTriShape you’re replacing and enter those numbers into the Data and Skin Instance slots.
  • -You can also run Copy Branch on an entire NiTriShape node after changing the Root name if the vanilla nif didn’t have enough NiTriShapes. After pasting at end, go to the root node, increase Num Children by 1, double-click the green refresh symbol below it, then expand the list of children. At the end should be a None, change this to the number of your new NiTriShape.
  • -I’ve also found that the splicing only works correctly if the NiTriShapes are not children of any NiNode other than the 0 root node at the time of copying.
  • -After splicing in your data, you can adjust the BSLightingShaderProperty and its BSShaderTextureSet (I avoid using the BSLightingShaderProperty exported by Blender but do as you will).
  • -BSDismemberSkinInstances will sometimes not have the Part Flags “PF_EDITOR_VISIBLE” and “PF_START_NET_BONSET” which are necessary for rigging in-game. If you are getting bizarre deformations when the mesh animates but they look fine in Nifskope, be sure to check this. Toggle these on all partitions for each BSDismemberSkinInstance inside Nifskope. I haven’t been able to set these from Blender.

you can find the used version of niftools here.


Walkthrough of installation of the plugin

1) Installing the Niftools, you have to put them in the blender folder and under user/appsroaming/blenderfoundation/blender/versionnumber(for me 2.79)/scripts/addons.

2) You will activate the Niftools like in the first picture (user settings/ addons/ ). click refresh at the bottom if it doesn’t appear.
unknown.png

3) It will show you a message like this when Blender found the Niftools installation. It still works, despite the warning.
unknown.png

4) Those are the export settings at the end:
unknown.png

5) Set the shader flags accordingly, read up on Haydens general export tutorial if you missed it or want to refresh your knowledge.
you can also read in this PDF what the shaders do, I gathered info from some well-known tutorials out here.
unknown.png

6) At the right, there is the vertex paint for weight painting.  These are basically representing the skeletons. In the vertex paint mode for weight, red represents stiffness, yellow the middle and green a super light influence that is not much affected by the bones movement. I still have to look into that myself. When looking into vanilla meshes, you will notice that joints and areas next to bones are very red, and the more you get distance, it becomes yellow, then blue and green and fades finally.

unknown.png

For the start, it’s best to copy the vanilla weight painting and using a similar shape.
On a side note, steam auto-updating blender might be a useful feature, if you don’t use a Niftools exporter version that relies on a specific version of Blender, like 2.49b.

Weight Painting is done here: (Weight Transfer Tool)


Special topic: editing weights for rigid protrusions (spikes etc)

When adding objects such as spikes that protrude from the body of a creature/armor, you will usually want those protrusions to be rigid.
That is, you don’t want the spike to bend around as the creature animates. The entire spike should animate together as a single unit. Since only the base of the spike is attached to the creature, when the base of the spike moves, the tip of the spike should move along with it.

Unfortunately, when using the Weight Transfer tool to automatically rig the protrusions, they will often have different weights assigned at different sections of the protrusion, causing it to bend as the creature animates. This must be fixed manually.
badweighting.thumb.png.296a74830a4e3b6c7f58c78e2e410fc9.png

Step 1. Use the Transfer Weight tool (see post above) to transfer weights from the body of the creature to the new protrusions (must be two separate objects in blender). You will probably see that each protrusion has a variety of weights (colors):
step1_TransferWeights.thumb.png.a0458d667b5b0a34c42ee678c4c12d53.png

Step 2. Open the spike mesh in Edit mode. Select all vertices for a single spike. If the spikes aren’t connected you can do this easily: select one vertex, then hold Ctrl and hit Numpad+ a few times.
step2_SelectVertices.thumb.png.c55c59d11a72266f343dc514c282ab39.png

Step 3. Open the spike mesh in Weight Paint mode. Enable the option for Vertex Selection Masking. You should see yellow dots on the object you selected, and black dots everywhere else.

Step 4. Using the Vertex Groups section found in the Data tab, find all bones that are affecting this protrusion (any color other than the darkest blue, anywhere on the spike). I suggest using the arrow buttons to organize them so that they are all next to each other in the list.

Step 5. For one bone, set the weight of all selected vertices. You can type any weight into the area where it says “Weight:”, then click Assign. But how do you know what number to type? This takes some trial and error:
5a. Look at the area where the spike meets the creature’s skin. The color found here is the color you want. There may be some small range of colors in the area where the two meet, if so just choose an average color for this area. (If there is a wider range of colors this technique might result in some “sliding” when animated — see the Sliding Fix below.)
5b. Give a guess for the number value of this color (Blue = 0, Teal = 0.25, Green = 0.5, Yellow = 0.75, Red = 1.0). Assign that value while watching the edge of the spike closely.
5c. If your guess was wrong (the color at the edge between spike and skin changes), hover your mouse over the render window and hit Ctrl+Z to undo the change. Type another number and try again. Repeat until you find an optimal weight.
step3-5_EditWeights.thumb.png.96a72835e27914ef1437c5bb8abef5ed.png

After a successful Step 5, the spike’s weight should blend perfectly where it connects to the skin, then maintain that exact color for the length of the spike:
step5_successful.png.8d8351729f22ff9830c13c43379e89cb.png
(To get this view, I’m merging the two meshes with Ctrl+J then viewing in weight mode. Then undo the merge with Ctrl+Z.)

Step 6. When you’re satisfied that the weighting for that bone on this spike is good, proceed to the next bone that is effecting this spike and repeat Step 5.
step6_NextBone.thumb.png.b47993a91064b97ec75ac689a49f62af.png

Step 7. When this spike is appropriately rigged to ALL bones that affect it, choose another spike and repeat Steps 2-6.

The final result should look like this:
before_after.thumb.png.e104e6aa3f27602d99b63e478fc5a30c.png

 

Sliding Fix
Now, as mentioned in Step 5a, there will sometimes be a “sliding” effect if you completely rigidify a spike that had a wide range of bone weights at its base. The spike will stay solid while the flexible skin underneath it moves in various directions, giving the appearance that the spike is not attached to the skin.

In these cases, you may want to leave the vertices near the skin with their initial weights from the Weight Transfer tool, and only edit the weights for vertices that don’t directly touch the skin.

In Step 2, just only select the vertices that are far from the surface of the skin, then proceed like normal. Here you can see that I only selected the 7 farthest vertices of this spike and left the remaining vertices untouched:
sliding_fix.thumb.png.18323a8852f02e3062d8c22643d0ea81.png

That’s it! Once you’ve edited all of your protrusions, your model should be ready for export! :)

goodweighting.thumb.png.f63a9c9cb0f75ef0aa3e5b726c9782c2.png

Congratulations and have fun with your rigged creature!

Content by OpusGlass, tested by Gahmuret, edited by Hannes821.

Learn more, join our community!




Arcane University (also for non-members!)



Welcome to the Arcane University! We are a collaborative effort of Beyond Skyrim aiming to help people learn the various aspects that play into mod creation, like scripting, level design or 3d modelling to just name the major ones. If you are interested in learning one of these or just want to help out others achieve their goal, feel free to join us on our Discord server and begin your journey. Previous knowledge is not required, only that you are willing and eager to learn. Below you can find some work that students of the Arcane University made during their time with us. By honing your skills you can eventually graduate, those students may choose to work on one of the various Beyond Skyrim teams or the Atronach Forge, our cross-province content creation hub. So it is a good chance to get involved with the project and learn a few handy things along the way. Hope to see you soon!




By | 2018-09-13T15:29:49+00:00 August 4th, 2018|Animation, Tutorials|0 Comments

About the Author: