Jump to content

Skyrim and blender 2.8+ - Working with meshes, animation, HDT-SMP and behavior in 2021.

Recommended Posts

This thread will contain write-ups of my workflows, both as my own reference resource and for anyone else's interest. Give me some time to fill each section.

Things have definitely changed over the last year or two and some of the old guides are no longer relevant, and often also overly convoluted.


In fact, it has never been easier to go from Blender to the game.

You dont need old versions of blender like 2.49, 2.79, you dont need old versions of nifskope. Just get the new, way nicer versions.


As with any guide I should stress that this one might be outdated, if you are a reader from the distant future (hi :]), be sure to take a good look around - maybe there's even better stuff out there.

Please show appreciation to all the people who have poured in huge amounts of time and effort to make these tools, programs etc.


Programs used




Tools for creating and exporting animations

You need a .blend file containing rig and scripts as well as programs made by a combination of Anton / TKTK / skyrim animators discord (main contributor is Distar & Jovel I believe)

This rig has been around for a while and have received incremental improvements and contributions from these different people over time, at this point it's quite sophisticated and intuitive. 

It takes a little effort to set up however.

You'll need this file from TKTK, hosted here as of writing - google translate from Japanese:



Download and extract to a folder, expected file structure:




Animating with the Female.blend or Male.blend here is absolutely fine.

In my opinion this blend from the Skyrim animators discord is even better:




Made by Jovel.

Just drag and drop this .blend file into the same folder and use that instead, they all work the same way.

Note that the scripts in these .blend files assumes you have this exact folder structure, and will not work otherwise unless tweaked.

Note2: There might be newer versions available as of you reading this, if you are interested in animating in general you can probably find your way to the Skyrim Animators discord and learn a lot - find new tools, guides, contribute to ongoing projects etc.


Tools for importing meshes and animations to blender

The blender niftools plugin is my main way of getting things into blender, it's the easiest and most straight forward. Still being actively developed. Get it here:


Note that exporting skinned meshes with this addon can be quite shaky. So I am only using this for importing (as of writing, maybe works just fine when you're reading this).



Tools for exporting meshes, skeletons from blender

Note: I'm using the "optional fork version" below instead.

Note2: Program might only work for window 8 and later (I'm using Win10)


Here's where some cool stuff has happened over older guides. Talented people on the Skywind team, main developer Aerisarn, have created an amazing tool called ck-cmd which vastly improves the exporting quality from blender. Usage guides for relevant commands can be find under the later sections in this guide. Github here:


This github repository uses build artifacts, which only lasts for 6 months after the latest successful build, and is also slightly hidden if you don't know how to find them.

How to download from this repo:

1) Click the "build" button under the code section. The button likely says either "Build | Failing" or "Build | Success"

2) You will see a new page with information from the latest build attempt. If this is a successful build, find the "artifacts" button and click it. There's your .zip. Otherwise continue reading. 

3a) If the latest build wasn't successful, then find the "history" button on this page, scroll down until you see the latest successful build. Click it.

3b) Now find the "artifacts" button and click it, there's your zip (if it's been less than 6 months since built).


Optional fork version

One of the forks of this repository contains, as of writing, a compiled released version of the program. Here:


Click releases, download. I am using this one.


Expected folder structure (make sure to also get the "libfbxsdk.dll")





The .bat files are small scripts that lets you drag-and-drop a .nif or .fbx file on top of them to quickly use the importfbx and exportfbx commands respectively.


--------------------------------------------------------- Guide Section ---------------------------------------------------------


1) Exporting meshes from blender to nif

1a) Skinned armor and character meshes, something you can wear (or 'be')




These meshes have NiNode base nodes. Their skeletons (in most well made-nifs) are flattened, i.e. in nifskope you don't see a hierarchical structure of nodes for the skeleton, every bone node in the skeleton is instead a direct child of the root node. With the exception of HDT bones (see appendix/extras). For these you should the ck-cmd command importskin.


Creating and weight painting outfits and armor

This blend file might be of use, it's a trimmed down version of the SAE.blend with the 3bbb body model imported as well as the vanilla body. Armature bones have been named properly. It's a good base for modeling your outfit, weight paint and test your weight painting easily.




Keep in mind that for Skyrim, and basically any game engine, weights are normalized to sum to 1 for any given vertex. I.e. if one vertex has two bones influencing it, painted with strength 0.1 and 0.2 respectively, this will result in a weight of 0.33 / 0.67.

For this reason, it can be useful to select "Armature" -> "normalize all" when in weight paint mode to visualize what the painting will actually look like to the game.

If you have a vertex/shape influenced by a single bone with low weight (say 0.3), when exported the game will interpret it as 1.0 weight.



Once you created your amazing new outfit and finished weight painting there's some fundamental pre-export checks. These things can easily be googled if you need help:

-All objects should have their origin at the world origin and have all their transformations applied. 

-Triangulate faces.

-Check your number of faces, the polygon limit for a nif is roughly 65.000, at least for LE - not sure for SSE. Decimate if needed.

-Make sure to UV unwrap properly after doing the steps above.


Time to export! To use ck-cmd you need to export as .fbx

If using the above .blend file and it's rig, these settings should work fine:





Under transform, leave "Apply Scalings", "Forward" and "Up" at default values. Put scale at 1.0 (or at correct value if you know what you are doing).

Under Armature, uncheck "Add Leaf Bones"

Set the Primary Bone Axis and Secondary Bone Axis (try with the shown settings if unsure).




Step two, .fbx -> .nif using ck-cmd

For armors, outfits & characters we will use the importskin command. This flattens the skeleton and adjust the skin partitioning (weight painting) accordingly.




Below you can see a gif of this exported dress in nifskope.

Note that im clicking the "Do Skinning" button and the "Show Nodes" button to verify that the mesh seems alright.

With added textures this mesh is game-ready* in both LE and SSE.


If your mesh "tears" when you hit "Do Skinning" You likely have incorrect primary and secondary bone axes.

You can trial and error change them and/or read the extras on "Bone rotations & axes, the right handed rule"


*game-ready for this particular nif, ck-cmd sets body partition to SBP_32_body always - which is usually appropriate for an armor/dress. You have to change their Body Part flag accordingly in nifskope if they should use a different body part.




Extra note/troubleshooting:

Depending on version of ck-cmd used some NiTriShapes can be children of redundant 'extra' NiNodes, this can cause crashes especially on LE. I couldn't find an example .nif with this behavior as of writing this.

In that case you need to move those NiTrishapes to be children of the base NiNode. Just copy the nitrishape and paste on the base NiNode.

The "fork version" of ck-cmd in https://github.com/TackYs/ck-cmd attempts to fix/improve this, in my experience it can still happen though.



Exporting a skeleton, to nif and .hkx




There can be a few reasons to export a skeleton; such a entirely new race/creature (not covered here - Skywind stuff, I have no clue).

But more importantly for this tutorial it's needed when creating animated static meshes and custom behavior.


Exporting a skeleton is very straight forward, using the dress example from above, simply uncheck mesh and only leave armature when exporting to fbx :




In ck-cmd, we're going to use importfbx with the exact same fbx file




which gives a nif with intact parent-child hierarchy:




To get .hkx files we instead use importrig:




Which will give you a LE and SSE version of the skeleton in .hkx format:




Later sections will have use for files like these.



1b) Static meshes - clutter, objects, furniture, magic effects - you name it. Including animated versions.




Jointly these meshes typically have a BSFadeNode as their base/root nif node.


When exporting these types of objects you don't want to flatten the skeleton. Instead opt to keep the hierarchy (if the object has a skeleton).

They all share the same workflow for exporting the model, you should use ck-cmd command importfbx


When exporting a BSFadeNode mesh with animation you can do things in different ways. The process I use have, perhaps, more steps than necessary - but I feel like I have better control. I start with first exporting the mesh as a static BSFadeNode nif like outlined in this section, and animate it afterwards.


If you are planning to export an animated static mesh it's probably wise to read both this section and 2b) before starting.



As an example, here's a vacuum bed I retopologized and later animated for "Rubber Facility" by Prime & Serah (shameless plug!)




This doesn't actually have a NPC/player in it, it's a static mesh.


When exporting statics it's many times useful to create collision so we'll do that. (You dont need chunkmerge).


To get collisions with your mesh, put everything you want to export in a collection, and outside that collection add an empty.

Name the empty "_rb"




ck-cmd will try to fit collision around your objects. This might not work if you have a complex setup, like happened here:




What to do then:

* Create a new collection

* Add a simple shape that represents the collision (triangulate faces &  apply transforms!)

* Disable the collection containing your normal model(s)

* Export this as fbx then paste over the bhkCollisionObject in nifskope




After using ck-cmds importfbx command it looks like this in nifskope:




Simply copy over the highlighted bhkCollisionObject from this .nif to your main nif.


Result is a vacuum bed with collision, note im clicking the "Show Collision" object to visualise the added box:




Note that we also have to start caring about BSXFlags, this nif now has a havok object, namely collision and the flag must be set for it to do anything in game:




We will leave the vacuum bed for now, and get back to it when doing animations for nifs like these (2b)


Slap on the textures you want, do the boring CK stuff - and you're done:









Link to post

Part two, very much work in progress. Give me some time.


2) Animation

2a) Exporting character animations. Swing a weapon, shake your butt. 


Exporting character animations using the SAE.blend is fairly straight forward, but there's some features of the SAE rig that's nice to know.


I will only show how to use the .blend to produce a .hkx file. After that it's up to you to learn and use the CK, FNIS or Nemesis or DAR depending on what you are doing.


TL:DR Just tell me how to export!




Make animation. Have a blender text editor view up  with the "1_Animation Exporter" open. Click the button highlighted in red in below gif.




You can have a blender console window open to be able to see what the script is doing/progress (as seen in gif).

Open the console through this menu




Your animation will show up as a LE (32 bit) .hkx inside this folder:




Yea. That's all there's to it.




Some features of the rig and animating with it





The rig is pretty complex, it can be useful to start with clicking around between the skeletons bone layers and see what's in there.




If importing an animation (.kf) these keyframes will end up on the bones in layer one - top left. Dont animate using these*.


The other layers are separate bones, including a complete copy of the rig in layer one. These are constrained to follow bones of the skeleton in layer one - however they can be modified further.


This is a huge benefit, as seen in the "building on an existing animation" section.


Layer 2 and 3 are your best friends. These are some IK and main body bones with user friendly shapes.

These will likely be enough for most things you ever want to do. Animate and keyframe these. Then export according to the TLDR.



*See note at end of "building on an existing animation"



Building on an existing animation




A massive benefit with this setup is to build on a similar or vanilla animation, to adapt or improve it.

1) convert an existing (LE!) animation to .kf using hkxcmd. (there's plenty of guides, google if you don't know)

2) Import the .kf through the blender niftools plugins "import kf" functionality.


If you select layer one of the skeleton, you should see all the keyframes popping up, for these bones.

Bones in other layers will not get any keyframes.




Many animations imported like this can have very weird things going on with keyframed scaling. 

Luckily there's a quick solution, it never hurts to select this script in the dropdown menu and run it after importing. It removes all scale keys.

If your imported animation looks weird, run this.




Use the bones in layers 2-6 to modify the animation to your liking. I recommend starting with adding keyframes for the bones in layer 2 and 3 at the start and end of the animation (if you intend to keep it quite similar). Then you can go crazy in between:




You can find way better guides, youtubes etc on blender animation than I could ever provide here, by just browsing the web.


NOTE: Yes, there are cases when it can be very useful to poke around in the keyframes of bones in layer one. Especially deleting some of them when you start to diverge a lot from the original animation. Play around and figure things out, discuss in the thread, find some relevant modding/animation discord.



2b) Static mesh animations. Create animated furnitures, backpacks, wings... tentacles?


These types of animations is messier to create than character animations, you'll have to spend a little more time in nifskope.

BSFadeNode nifs can be animated in a few different ways. Typically you add Gamebryo animations to your nif through NiControllerSequences that control the skeleton. After adding animations, these can be manipulated with papyrus scripts through PlayGamebryoAnimation. But you can take it one step further and add havok behavior, at which point animations can be controlled with SendAnimationEvent which has some extra uses.


Extra program & script needed




We'll make use of Anton's skeleton extractor and a modified version of the 1_animation_exporter script from SAE.blend:


1_Animation Exporter_static.py


Note that this script assumes that your .blend file it in the same folder as the character animation .blend files.



The process




1) Create a skeleton for your BSFadeNode nif. For simplicity sake it's good to name the root bone "NPC Root [Root]" - This will make Antons skeleton extractor automatically find it. Recalculate rolls of your bones to global +Z axis (or try without and troubleshoot later).

Instruction: with the armature selected in object mode, click armature->bone roll->recalculate rolls -> global +Z axis or whatever axis you choose. 


2) Weight paint.


3) Animate something simple to test.

If/when you get the the export working nicely you can go back and make a more fancy animation, and/or add more animations to the same nif.
Start your animation from frame 0, not frame 1.


4) Export the skeleton to nif, according to info in 1). Also export a version of your whole static nif, including skeleton - if you created a nif following 1b) and didn't add the skeleton at that time.


5) Now we're going to create a skeleton.txt file using Antons skeleton extractor. Drag-and-drop the skeleton nif on top of the program, a text file with the coordinates of all bones in the skeleton appears one folder up, as "01.txt". See gif:





Put this "01.txt" inside the "tool" folder of your "Animation Tools N3+28" folder (see first screenshot in "Tools for creating and exporting animations" )



6) You can now export your animation using the 1_Animation_exporter_static.py script. Open this script in a text editor view in blender and export the animation by running the script. If you renamed the text file to something else than "01.txt" you have to change the name in the script, it's clearly marked with an all-uppercase comment.

Instead of a .hkx in the convert folder, like for character animations, you'll now get a named .kf file:




7) Open your nif in nifskope, and import the animation:

Spells -> animation -> Attach .kf 




Help, my animation looks something like this!?






In these cases, re-export your static mesh to fbx from blender, but change the primary & secondary bone axes.

In this gif it looks like the "up" axis is correct, and the other axis is 90 degress wrong so I'd just change the secondary axis from y->x.


You don't need to redo the antons skeleton extractor steps, just export to fbx, convert to nif and re-try importing the .kf until it looks correct.


When your animation looks fine there a small checklist of things you need to do in nifskope:
* On your root BSFadeNode, set "controller" to the index of the created NiControllerManager
* Remove the NiControllerManager from the skeleton node that got it when you imported the .kf.

   -Double click, clear with backspace and hit enter. It should say None afterwards.
* In the NiControllerSequence, change Cycle Type from CYCLE_CLAMP to CYCLE_LOOP (if you want a looping animation)
* If you want your animation to play automatically, make sure it's named "SpecialIdle" (it likely has that name already)


8 ) Add textures, collision(optional), and update bsxflags accordingly:




Do the boring CK stuff again, and check it out in game:



To add more than one animation, and control these with behavior - check out 2c) !



2c) Notes on behavior editing for static mesh animations



Creating HDT/SMP armor

Descriptions of extra scripts contained in SAE.blend


Technical stuff; bone rolls & axes, the right handed system, quaternions and gimbal lock.


 Primary and secondary bone axes - and a bit on bone rolls




One of the trickier parts when exporting from blender as .fbx is coordinate systems.

Blender uses a Z-up, right handed system (Y-forward/backward). wikipedia.

3ds Max and Maya also uses a right handed system, but Y-up (Z is then forward/backward).

However, the story doesn't end here. Other engines, such as Unity, uses a left-handed Z-up system and Unreal Engine uses a left handed Y-up system.





This trickles down to the bone level, and is why you have to set the "primary bone axis" and "secondary bone axis" when exporting .fbx.

Blender cannot know for what game or engine you are exporting to, and the fbx format is intended as a format to be used in any engine.

Getting some idea about these things will help you create and export not just for Skyrim!


think skyrim uses the same system as 3ds Max and Maya. But I've seen confusing things sometimes and math is hard, mmkay.

Long story short, set primary axis to Z and secondary axis to -Y or Y (the axes of the "target" system). In my experience this gives proper results for most nifs.

If you're reading this and really know what's up (get it? ;)), please let me know.


Nitpicky note/disclaimer: Technically the different engines/programs either use the left handed or right handed system. Whether they have Z-up or Y-up within that system is simply their "world coordinates". This fact wont make the math any easier or help you at all.


Bone rolls

If you ever have to deal with bone rolls and are unsure what to do these things also become relevant.

You might have to deal with rolls if you are  merging armatures. The armatures might be set up with different coordinate systems in mind.

This can be a big pain in the bum and I try to avoid this mess. Recalculate to global +Z if needed and hope it works out.



Quaternions and Gimbal lock




When animating, bone rotations are usually specified in Quaternions. This is a four-coordinate system, compared to Euler XYZ which has three. I find these kind of hard to wrap my head around, and it can be useful to know when you safely can skip them and switch some bones to Euler XYZ, which is easier to work with.


The main reason for using quaternions is to avoid something called Gimbal lock. A gimbal lock is a loss of one degree of freedom for rotation that can happen in some circumstances. Consider below gif from wikipedia




Imagine that the middle ring and outer ring are for some reason perfectly aligned. In that scenario, if you rotate the inner ring, or the outer ring, the rotation of the plane is the same - it spins around its own axis. You have lost a degree of freedom, the two rings causes the same rotation.

This can be solved by adding a fourth ring - and now you have quaternions. Their rotation axes are usually referred to as pitch, yaw and roll.


Now knowing how quaternions work and the terms pitch, yaw and roll - you can become a viper pilot like Starbuck 




If you have a simpler bone with limited rotations, such as this rune animation from my mod slinger (shameless plug!). 





It's quite easy to realize there's zero risk of gimbal locking. In these cases, save yourself some brainpower and set bone rotations to Eulers!




Link to post

I just put up a new version of SAE_for_outfits_base.blend if you're one of the two people who managed to already download it.

Two bones still had wrong names in the "skeleton" armature, and the "skeleton_hands" armature didn't have correct names.



Link to post

Thank you so much for this, will be following and probably asking a lot of questions soon.  I know Blender pretty well but up til now had never been able to export anything I make to Skyrim and I have a project now where I need to be able to make and export some static meshes, so this is perfect timing! 👍

Link to post
6 hours ago, Rubbermatt said:

Hrrmm, can't get CK-CMD to run, keeps throwing up a 'something missing in Kernel32.dll' error.


Ugh, rough one - I don't know.

From googling it seems like kernel32 errors can happen for a million reasons? :(



Link to post
12 hours ago, Rubbermatt said:

Hrrmm, can't get CK-CMD to run, keeps throwing up a 'something missing in Kernel32.dll' error.


Just to make sure, did you also grab the "libfbxsdk.dll" when you downloaded ck-cmd from github? Program wont run without it



Link to post

Yeah I did, double checked I had all the files, redownloaded everything, ran system check to look for corrupted windows files ... nothing.

Going to continue google searching for a solution.

Link to post

Great tutorial

When making animation, because skyrim and fallout4 need different versions of 3dsmax and havok, I can only choose one. Now, I can consider letting blender work for skyrim.

Link to post

first of all: thanks for the guide! (and the BSG reference :D)

i was under the impression that niftools requires blender 2.79 or lower,
does niftools now work with the newest version of blender (2.92 as of writing) as well?

edit: well, one peek into the changelog later:

Port to 2.8+  so yay ^^

(still: only LE formatted .nif's supported -> SSE .nifs need to be converted to LE format via SSE Nif Optimizer prior to importing them to blender)

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...