Sign in to follow this  
Followers 0

Exporting Static Meshes for Skyrim from Blender


11 posts in this topic

Posted (edited)

I've been struggling with the process of modelling static objects in Blender and exporting them for use in Skyrim. One day, no doubt, there will be a whizzy Blender export tool from those wonderful NifTools people but in the meantime I'm using a pair of stand-alone tools by Skyfox. I understand 3DS-Max can export Skyrim format files, but can't handle the collision. Blender can't do either.
So, what's the problem anyway? Well - mostly that Bethesda have reworked the nif file format - again - and it's not yet fully understood. However great strides have been made and it does seem to be possible to make new stuff now.
No doubt many of you already know all of this - but you didn't tell me! So I'm telling everyone else. This is my current process, and hopefully by the time I've finished writing this I'll have succeeded in getting my first static model into Skyrim.
Deep breath: in we go.
Essentially, there are two processes required: creation of the visible mesh and creation of the collision.
If you are a 3DS-Max groupie you'll need I know nothing about that.
For Blender, we need the classic TES modelling combo: Blender 2.49b and the current Blender Nif Scripts. I'm using 2.5.8 which I think is up to date. There's some jiggery-pokery required to get Blender to look in the right places for texture files - get that right and it will suppress the part of the file path before textures during the export.
You will also need NifSkope vn 1.1.0-RC7 revision 6d41868. Assume these instructions won't work with any other release - definitely not earlier ones and likely not later ones either.
Finally, you'll need Skyfox's tools.

IMPORTANT: There is a new release of Skyfox's NifUtils which I haven't tested out yet. I'm sure it will be an improvement, but the old version appears not to be available any more. I will try out the new package as soon as I get time. Otherwise, you're going to need to download the new version and wing it a bit.

The official release thread is  on the NifTools forums at Sourceforge - you should be able to reach the current release from there.

This tutorial uses the last version I downloaded (24th June 2012) -  NifUtils_20120607.7z which is what all the screenies show.
 

I'll explain all this in a bit.
OK - make a model. I'm making a wattle-and-daub walled thatched farmhouse hut for use in Northern Elsweyr. It basically serves exactly the same purpose as the Skyrim farmhouse set and has the same footprint as farmhouse05. In fact it's extremely similar, but I promise I modelled the whole thing from scratch.
As a reference point, I'm going to import the Skyrim farmhouse05.nif. This is what you'll need to do if you actually want to alter the base model.
Open NifSkope and change Render / Settings / General / Startup version to 20.2.0.7 if it isn't already set.
Now open the file farmhouse05.nif. You're going to do some destructive editing here, so personally I always save to a new file before anything else - just in case. I'll save to reffarmhouse05.nif
To make Blender read the file correctly, you need to change some fields in the header. To bring up the header at any point select View / Reset Block Details. You should be able to see the NiHeader block in the Block details window at the bottom of Nifskope:
gallery_82_50_123792.jpg
Change the value of User Version from 12 to 11
Change the value of User Version2 from 83 to 34
You also need to remove any BSLightingShaderProperty branches as they can't be imported into Blender. Select the node and press <ctrl><del> to delete the branch. Repeat for BSLightingShaderProperty nodes in all the NiTriShape branches
Unfortunately, this will remove any texturing information too. Sorry about that.
Blender doesn't understand bhkCompressedMeshShape nodes either, so the whole bhkCollisionObject branch needs to go too.
gallery_82_50_134166.jpg
Now you know why we're working on a copy. Save the file out again.
Now it should be safe to import the nif into Blender. Mostly the defaults work fine - the bigger the scale factor the smaller the model ends up in blender. I used a scale factor of 100 - but that was a bit excessive.
As I said, I only used this as a guide for sizing and made all my meshes from scratch.
I've temporarily recoloured some of the original textures to save time but I'll make new ones for those too when I get a chance.
Later on in the process, when we convert the textures, the tool will expect all textures to be in the same folder, so it's probably worth modelling that way in the first place.
Here it is. Pretty, huh?
gallery_82_50_671.jpg
Each separate object in the final model should have only one texture, but the object can include several different meshes.
You'll see I've tried to give most of the objects fairly meaningful names - just so it's easier to work with them in NifSkope later. I don't think Skyrim gives a stuff what things are called.
Each object in a Skyrim nif seems to have has its Centre at the origin (0,0,0). So when everything's modelled up into separate pieces, press <ctrl>-C to centre the cursor, A to select all and click the "Centre Cursor" button.
While you're at it, press <ctrl>-A and "Scale and Rotation to ObjData" - because the Niftools export will complain about something if you don't.
Right - now it's all modelled up, you need to export it to nif format, using the defaults for Morrowind files. Why? Because that's what Skyfox works with and it's his toolset. Let's call this tes3FarmHut01.nif
Make sure you have all the parts of the model you want to include in the export visible and selected. Select
File / Export / NetImmerse Gamebryo File (.nif & .kf & .egm)
The settings I have that seem at least close to right are:
gallery_82_50_106806.jpg
Hopefully the little progress bar made a few sweeps and you're back at the modelling window. If you were really daft enough to get this far without saving, do it now.
Now, I'm going to describe the lazy cheaty easy bad way to make collisions here. Don't do this. I'm going back to fix this Real Soon Now but I want to get this written up.
So what am I doing that's bad? I'm using the same nif file to create both the visible mesh and the collision. Naughty Morcroft. You'll be good and create a separate low-poly collision and save the game engine all that extra processing, now won't you?
Once you've made the low-poly collision, save that as well - let's say as tes3FarmHut01_C.nif
NifUtils
OK - now you're going to need to set up Skyfox's fabby tools. If you didn't download the pack when I told you about it earlier, go do it now.
Create a folder somewhere for the utilties. I'm using
E:GamesTESToolsNifUtils
extract the two files,
NifConvert.exe
ChunkMerge.exe
into it. Now create two folders under it:
Templates
Convert
These don't strictly have to be here, but it's as good a place as any. Templates is used to contain sample Skyrim nif files that the utilities will use. I'm not sure how many you need - Skyfox (or someone) said they used one of the farmhouse nifs for statics and also had a tree in there. I copied in farmhouse05.nif
These are essentially command-line utilities, but they bring up proper windows when they run, so the simplest thing to do is create a Windows shortcut to each of them.
Right-click on the exe file and selct "Create shortcut" then right-click the shortcut and select Properties.
Change the Target field to include the two required parameters: the path to your Skyrim data folder and the path to the templates folder you just created. So for my system the Target field for each shortcut reads:
E:GamesTESToolsNifUtilsnifconvert.exe "E:GamesSteamSteamAppscommonskyrim" "E:GamesTESToolsNifUtilstemplates"
E:GamesTESToolsNifUtilschunkmerge.exe "E:GamesSteamSteamAppscommonskyrim" "E:GamesTESToolsNifUtilstemplates"
Notice the odd trailing "" on the chunkmerge version of the Skyrim path. This seemed to be necessary but I could be losing the plot.
NifConvert - converting the mesh
3DS-Max users can jump to ChunkMerge now. The rest of us need to convert a Morrowind-format nif file to Skyrim format.
Oh, quick disclaimer here: you're not actually converting a file from Morrowind to use in Skyrim, are you? That would be Bad and against Bethesda's T&Cs. Not to mention the fact that Morrowind meshes really aren't up to scratch for modern engines.
Its easiest at this point just to copy your new (TES3) nif file into the Convert folder I suggested above. Then run your new NifConvert shortcut and populate the boxes like this:
gallery_82_50_5214.jpg
I've written out to tes5FarmHut01.nif .
When I click convert I get:
gallery_82_50_65611.jpg
Now, I'm not quite sure about all those missing textures, but my guess is that the tool was developed to run sitting in the Skyrim folder and is making an unwarranted assumption about the path. Doesn't matter, though: the nif file it generates is just fine. Well, it still needs work but it's pretty close - and this has just saved a ton of work I did by hand for my first, unpublished version of this tutorial.
To finish cleaning open the file in NifSkope.
Initially there may be references to NiStencilProperty and NiSpecularProperty sitting outsied the main tree. Just delete these.
Now, for each NiTriShape in turn:
Inside the BSLightingShaderProperty is a BSShaderTextureSet node, and in the block details for that is a list of Textures. The NifConvert may just assume normal maps exist and are named according to the *_n.dds convention. I haven't tested this but if you use any non-standard texture names they may need modifying here. Other map types go in other fields - I don't know if the order is important. Note that the path must be relative to the Skyrim data folder so will start textures
While you're in the BSLightingShaderProperty check "Specular Power - Glossiness" - it must be greater than zero. The higher it is the less glossy (I think). 50 to 80 seems about right.
If this mesh element should be double-sided then that is set using the check-boxes that are displayed if you double-click Shader Flags 2 in the BSLightingShaderProperty.
If there is transparancy in the texture for this mesh element then you need to copy over an NiAlphaProperty from somewhere and link that into the second Properties entry in the NiTriShape node. There's a suitable NiAlphaProperty on the thatching of the farmhouse nifs. You may need to adjust the flags and threshold values.
gallery_82_50_217727.jpg
ChunkMerge - creating the collision
ChunkMerge enables collision to be added to a Skyrim-format nif file. Just a quick word first about the phenomenal job done by Skyfox in particular and the NifTools team generally in decoding this heavily encoded structure. I've read the thread on SourceForge - it's terrific data detective work.
So, to use this tool, run the shortcut created earlier. Select the tes5 format version of your new mesh, and for the collision select the exported nif for your reduced poly mesh. Remember - I'm just slacking here by using the same for both - I will do the remodelling work eventually:
gallery_82_50_14984.jpg
gallery_82_50_26013.jpg
The program will update the original nif file with the new collision so you can just copy the file to its final location and rename it as appopriate, in my case elsFarmHut01.nif.
Then it's just a matter of creating the definition for it in the Creation Kit. When you drop it into the render window you can press F4 to see the collision mesh outlined in black. Here it is:
gallery_82_50_145380.jpg
Note that's a 4600-poly collision mesh - probably about 10 times too many.
Addendum: See for more info on the collision.

Translations

Elros3112 has posted a French language translation of this tutorial.

Edited by morcroft
2 people like this

Share this post


Link to post
Share on other sites

Posted

Thanks for the tutorial. I think I'm getting close. lol

Share this post


Link to post
Share on other sites

Posted (edited)

Addendum:

OK - I've now been good and modelled the proper collision mesh up. This is it:

gallery_82_50_216908.jpg

Notice that this mesh has only 344 (triangular) faces. This is much more like it.

The collision is a new mesh object, with the settings shown on the Actor panel - the one with the pacman. Collision meshes can be essentially any modelled shape, they just need these settings under the Object (F7) panel:

gallery_82_50_6228.jpg

Include the collision mesh in the set of selected objects when you do the export to nif file, and the whole thing comes out properly collisioned. Use the same settings as before for ChunkMerge and it all just works. Well, does for me, anyway.

Edited by morcroft

Share this post


Link to post
Share on other sites

Posted

Haven't gone through this yet but you're advising the use of Nifskope 1.1 RC7. That has a crippling bug in the UV Mapping portion. It imports those as garbage. You'll need to use RC6 until they've fixed that.

Share this post


Link to post
Share on other sites

Posted

Might just be what I was doing with it, but yeah. RC6 never botched any of them. RC7 botched them all. I hadn't seen your tutorial at the time though so it could well have been because I went through export/import as .obj files. Which works beautifully with RC6 and isn't anywhere near as complex as what you have here. The downside of course is that it won't do collision in that format. Fortunately what I was doing at the time didn't need it.

Share this post


Link to post
Share on other sites

Posted

Might want to play with it a bit more. There's another guy on Beth who says he's never had a problem either, but as Arthmoor says, several people apparently did have a problem and reported it on Nexus. Unfortunately without talking to them all directly, we're making a lot of assumptions.

RC7 might have some valuable fixes and it might require a very specific method to import and export things properly. I wouldn't know.

Share this post


Link to post
Share on other sites

Posted (edited)

IMPORTANT: There is a new release of Skyfox's NifUtils which I haven't tested out yet. I'm sure it will be an improvement, but the old version appears not to be available any more. I will try out the new package as soon as I get time. Otherwise, you're going to need to download the new version and wing it a bit.

The official release thread is on the NifTools forums at Sourceforge - you should be able to reach the current release from there.

I'll update the tutorial when I get a chance.

Thanks to Harmony90 for alerting me to this.

Edited by morcroft

Share this post


Link to post
Share on other sites

Posted (edited)

Maybe the new version will change this, but for now I think it is important to note in your tutorial that blender and python 32-bit are needed. I have always used 64-bit and have never been able to convert properly. to quote the readme, and thus avoid the accusation of being a liar, "Note: on Windows, use 32-bit versions of Blender and Python. (The 64-bit version of Python lacks xml parsing which is essential for the scripts to work.)" Maybe you mentioned this and I just missed it though...

Edited by DoulosTheou

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0