PyNifly, by BadDogSkyrim (yes, THAT bad dog)
https://github.com/BadDogSkyrim/PyNifly/releases
Old workflow:
Tools:
- NifSkope (oficial): https://github.com/niftools/nifskope/releases
- NifSkope (my fork): https://github.com/megapatato/nifskope
- Bodyslide & Outfit Studio: https://www.nexusmods.com/skyrimspecialedition/mods/201
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)
- Revert to Oldrim format using NiTriShape converter, by opparco (https://www.nexusmods.com/skyrimspecialedition/mods/19911)
- Duplicate geometry to have faithful havok model; duplicate the file (or make a new one in Blender with fewer polygons)
- Use ChunkMerge from NifToolsSuite to merge (source: https://github.com/skyfox69/NifUtilsSuite, compiled: https://www.nexusmods.com/skyrimspecialedition/mods/97986):
-> the geometry from one becomes the havok collision geometry in the other
-> use the shape name for materials; or set a single material for the whole thing
-> ChunkMerge works better with the right Nif.xml and templates: https://wiki.beyondskyrim.org/wiki/File:Chunkmerge_Utils.zip - Use NiTriShape converter to upgrade back to Newrim format
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.
20 comments
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...)
https://www.nexusmods.com/skyrimspecialedition/mods/97986
I hope this is what you're looking for? :-)
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)
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) 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...).
How hasnt a working Blender importer/exporter been developed after all this time and so many modders :o
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.
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 !
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)
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 !
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+
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.
If you don't mind me asking, concretely what are you trying to do/make/alter?