New workflow:
PyNifly, by BadDogSkyrim (yes, THAT bad dog)
https://github.com/BadDogSkyrim/PyNifly/releases



Old workflow:

Tools:



Getting a mesh:
  • Open asset in NifSkope, export as OBJ (File -> Export -> Export .OBJ)
  • Import in Blender; choosing Open instead of Import can crash Blender. Drag n'drop sometimes uses Open.
  • After importing, sanity check your axes, or you'll have to fix orientations on export.
  • [magic occurs in the blender; when in doubt, add more peppers]
  • Export from Blender as OBJ. Neither vertex colors nor alphas are supported by OBJ, and the materials sheets is often misunderstood. I often don't export Normals either. In any case, just make sure you triangulate your mesh and include the UV coordinates. Export with OBJ groups, so the multiple objects in Blender end up as multiple OBJ groups, and downstream tools have them as separate BSTriShapes.
  • Import in OutfitStudio from OBJ, export as NIF (in my experience, OS has a more robust import function than NifScope)


Blender supports vertices having up to N normal vectors, one per face the vertex is a member of. OBJ and NIF only support a vertex having one normal vector. So when exporting with normals, the OBJ will produce N vertices, one per face, for each vertex in multiple faces. These are non-merged, and a great complexification of the object. If you're painting vertex colors, non-merged vertices frequently lead to broken interpolation. Hence why often don't include vertex normals in the first export.


Now to add collision geometry (details NifTools docs)
If your mesh has vertex colors and/or vertex alphas, NiTriShape converter will destroy that data. You can use Ctrl+C to "extract" the havok geometry from the file in 4 above, and paste it back into the file you got out of OutfitStudio in the beginning, then work from there. The havok node can be moved around independently of the visible mesh; they can even be in different files (if you like confusing people...).


Polish:
  • Set the texture to the correct paths & other visual properties (OutfitStudio copy-from-shape, or just manually in NifSkope, or Ctrl+C/V)
  • Add BSXFlags node at index 1 to root node, set it's flags to 130 (bits 1:Havok & 7:Articulated on, the rest off), values taken from RiftenRWThievesGuild03.nif (RatWay)
  • Transform the root node from NiNode to BSFadeNode, so stuff is clickable in the CK's render window
  • Sanity-check the havok material, and the havok settling layer (using the right template in ChunkMerge obviates that)
  • If you didn't export Normals, NifScope has under Spells/Batch/Update all Tangent spaces a function that does that (you may need to call it twice, once for the tangents, another for the normals). If your mesh looks "faceted", then you likely need to do this.


NB: the NifUtils suite used to be available for download from their GitHub, but the binaries have been removed. User Datarecovery09 found a nexus upload with the files (linked above); I have verified the executable at id=415654 game_id=1704 (aka v1) is identical to the one I got from GitHub years ago.

Article information

Added on

Edited on

Written by

megapatato

20 comments

  1. Jake2105
    Jake2105
    • member
    • 0 kudos
    So I'm trying to follow your guide, I'm down to the step where you need to use NifToolsSuite, I've downloaded the files from GitHub but there doesn't appear to be an execuatble to run the program? It's been a very long time since I've worked with C++ so I'm not in a position to compile it, did I miss a step somewhere? The docs folder in the NifToolsSuite download doesn't seem to mention needing to compile it or anything, it just starts off from when you open the program, which classicaly is the bit I'm stuck on haha
    1. megapatato
      megapatato
      • premium
      • 122 kudos
      Oh darn, there used to be compiled binaries available for download, but I'm not seeing any in the GitHub.

      If you open it in Visual Studio, it might "just work" with the default compilation recipe; I have not compiled it from source, I just downloaded the latest release (when they still had those available for download...)
    2. Datarecovery09
      Datarecovery09
      • member
      • 0 kudos
      Some great guy called 1990srider has uploaded a compiled release here on Nexus:
      https://www.nexusmods.com/skyrimspecialedition/mods/97986
      I hope this is what you're looking for? :-)
    3. megapatato
      megapatato
      • premium
      • 122 kudos
      Nice find!

      I compared their downloads to what I had gotten from the GitHub; the executable is identical, and the xml config file has just some user-defaults that are benign (i.e. it's as safe as the original)
  2. SniffSniff125
    SniffSniff125
    • member
    • 0 kudos
    hello, im completely new to modding, i've already edited many textures in-game, to create my custom character, but never touched a mesh
    i would like to know if its possible to create a custom skeleton and mesh. i would like to add a character from subnautica below zero, it is basically a centaur. 4 legs and 2 arms, i already have the armature and mesh in blender. but  i dont know how to integrate them into the game without causing problems, i also dont know if a custom skeleton is supported, how to export it and if i need any mod.


    any help would be extremely appreciated

    thanks in advance!
    1. megapatato
      megapatato
      • premium
      • 122 kudos
      Possible? Yes. But it's a huge amount of work, notably since you'd need to create a skeleton. If you could reuse existing horse animations plus existing biped animations, it would simplify some things (but make the third part harder.. probably....)

      1) The skeleton is a system of transformation / control points, the bones. To animate a mesh, these bones affect the vertices of the 3D geometry via a weighted transformation; those weights are the animation weights. Since none of the Skyrim skeletons apply for centaur-like hexapods (two arms, two front legs, two rear legs), you'd have to create a skeleton that has all those extra appendices; and bear in mind, appendices have several animation bones. Without enough bones, your animation will look too constrained (e.g. instead of the skin "stretching", the polygons will shear and the texture will over-stretch).

      2) Once you have a good skeleton with enough bones, then you'd have to make animations for the mesh given that bone system. The "manual" (& torturous) method is to do this by hand, for every vertex assigning it a combination of values that sums to 1 for all the bones of the system (most of these are zeros). Motion capture is often used instead, or an inverse-kinematics solver, or I'm sure other pipelines. If you can get the animation and weights from somewhere else, that simplifies part of the issue, but you'd still need to fit your mesh to the new skeleton. In Blender, this is done via vertex groups (I can link some YouTube things that talk more in depth, and offer keywords & search terms for you to look further).

      3) Assuming all this is done, you'd have to set up a Skyrim mod to declare a new race and point to your new skeleton. From there, and take this with a grain of salt because I do not know for sure, I believe you'd have to create a Havok behavior graph for your race. This behavior graph is what tracks the animations that play; an NPC is always somewhere in this graph, moving from animation to animation. This is true of dragons, fish, humans, and everything in-between. The software development kits for Havok are very difficult to find, but maybe there are other ways of creating this behavior graphs.

      Far easier would be to grab an already existing centaur, and fit your armature to its skeleton system, then use something like FNIS or Nemesis to extend the animation graph with whatever new things your character should be doing (like, using an Alchemy table...).
  3. listenwater4
    listenwater4
    • member
    • 4 kudos
    Is this really the method people use for all the custom skyrim models?

    How hasnt a working Blender importer/exporter been developed after all this time and so many modders :o
    1. megapatato
      megapatato
      • premium
      • 122 kudos
      The OBJ method is what I used a year ago. And yes, that was onerous ...

      But since then I've adopted to use BadDog's plugin; I've updated the article above to reflect this. Beyond convenience, it greatly reduces the number of steps, and allows me to keep vertex animation weights (usually...) and colors, which also makes the whole process less error prone.
    2. listenwater4
      listenwater4
      • member
      • 4 kudos
      I actually just found this and have been using it, its great
  4. Oblib
    Oblib
    • premium
    • 7 kudos
    Hello there ! 

    I set up Blender and NifSkope, I wanted to see something about an existing nif file : Where is it shown what textures the model will use ?
    When I open it, it’s all white, and there is no texture folder with the mesh folder, so I presume it uses «vanilla» ones, but how do I know which one ?  

    Thanks, that’s good learning material you wrote there ! 
    1. megapatato
      megapatato
      • premium
      • 122 kudos
      Hey there! Just saw this post (feel free to send me a message over the Nexus forums; at least that will email me a notification lol)

      Are you trying to see the textures used by a mesh, in NifSkope?

      If so, each BSTriShape (the object that has the 3D geometry, triangles and such) should have a lighting property (usually a BSLightingShaderProperty, which specifies information for the shader: skin, glowmap, parallax, hair, dual sided, etc), and it should have a BSShaderTextureSet node, which contains an array, Textures, with 9 SizedString entries, each a path to a DDS file.

      For example, TreeAspenStump01.nif (from Skyrim - Meshes1.bsa), the outer bark part of the tree is specified in node 15, a BSTriShape, which has a child node 16, a BSLightingShaderProperty, itself having a child node 17, BSShaderTextrueSet, which specifies


      textures\landscape\trees\TreeAspenBarkComp.dds
      textures\landscape\trees\TreeAspenBarkComp_N.dds


      If, when you open a NIF in NifSkope, it has issues finding textures, you probably want to start by going into Options > Settings > Resources, and making sure all the right paths & archives are setup.

      (If you're trying to visualize in Blender, it's a whole different thing)
    2. Oblib
      Oblib
      • premium
      • 7 kudos
      Thanks ! Yes, that was it… I simply didn’t tell NifScope where to find the resources… 😅Indeed, that works better now ! ^^
      Well, now I’ll just have to learn lol Feels quite overwhelming ! But I'll keep looking into it, thanks to people like you for helping us ! 
    3. megapatato
      megapatato
      • premium
      • 122 kudos
      The official NifSkope has a couple bugs, notably with copy+paste operations and quadratic interpolation. If you find some things broken, try my fork:
      https://github.com/megapatato/nifskope/releases

      I added my fixes as a pull request to the official repo, but it's devs. haven't been active in the past year+
  5. LaurellaBellaBean
    LaurellaBellaBean
    • member
    • 35 kudos
    Thank you so much! I cannot, for the very life of me, get Blender to work with nifs. Well, I can get Blender 2.8 and above to work but I'm not familiar with that version. Blender and a .obj? No problem. Blender and a nif file? Nope. I've given up on that. 
    1. CatOfEvilGenius
      CatOfEvilGenius
      • supporter
      • 77 kudos
      What blender plugin are you using to import nifs? I have blender 3.3 and tried the plugin from the link below. It just crashes. Can't open face preset nifs, can't open facepart nifs. :(  Why is it that in 2022 we don't have a proper nif import/export?

      https://github.com/niftools/blender_niftools_addon/releases

      I can't get the plugin for 3ds max to work either. Is there some documentation somewhere for how to edit these meshes? I need to move vertices and adjust normals. Thanks for any help.


    2. megapatato
      megapatato
      • premium
      • 122 kudos
      I gave up on most of those plugins, hence why the tortured path above... my version of NifSkope (linked in the post now) has a primitive vertex painter, in case that's useful.
    3. LaurellaBellaBean
      LaurellaBellaBean
      • member
      • 35 kudos
      I just now saw your message. Just today I tried PyNifly with Blender 3.3 and it (so far) is working well. Here's the Nexus page. I downloaded the latest version (5.13) here.? My biggest problems are 1) getting used to Blender 3.3 (my fault for sticking with 2.78 for so long), and 2) figuring out how to adapt the ancient tutorials to what I need. All of them are for Blender 2.49 and all rely on niftools. If you know of any updated tutorials/instructions please someone, anyone, let me know!!! 
    4. megapatato
      megapatato
      • premium
      • 122 kudos
      Holy cow, that's a mighty tool indeed! Thanks for sharing. Unfortunately I'm not aware of useful tutorials... most use dead tools behind dead links that crash on startup :'(

      If you don't mind me asking, concretely what are you trying to do/make/alter?
  6. liamrippey
    liamrippey
    • premium
    • 0 kudos
    need more detail on how to export sse nif as obj for blender
    1. timsterse
      timsterse
      • supporter
      • 2 kudos
      step 1. in this tutorial should be changed. You can import SSE nif in OutfitStudio directly and export it as obj for blender. (right click the mesh in OS and choose Export OBJ). The only thing OS does is set object flag of the NiTriShape to 14, but that is not important 99% of the time. You can manually change it in NifSkope later if need be.