Netimmerse File format (.NIF) importer script in the works

Just a sort of announcement. I am working at an import script for the Netimmerse file format. So far I read and the geometries properly, though I still have to implement the vertex normals (Blender doesn’t seem to mind, but I’ll need them for exporting when I get to it). I am a total beginner at writing anything in python, and don’t know the first thing about the Blender scripting API, so it’s likely that my code isn’t the best approach at reading a NIF file in Blender. Anyone’s help in getting this to work would be greatly appreciated. The homepage for the project is at http://games.groups.yahoo.com/group/NIFLA/ , the code can be downloaded from the files section. Please feel free to drop in and give it a try, and possibly contribute at it.

[EDIT] Oh, yeah, I forgot. The netimmerse format is used by several commercial games, most notably Morrowind and Freedom Force. The script I am building primarily deals with the Morrowind version of the file (Netimmerse 4.0.0.2, same as Freedom Force) but I tried to keep the structure of the importer flexible enough to allow importing earlier or later versions with a few modifications. Other games using other versions of the Netimmerse files are Dark Ages Of Camelot and Bridge Commander

Thank you!!! I was going to learn python just to do this script, but I never got around to it. I love morrowind, and make mods for it, but I never could make my own models. This looks like it has alot of potential to increase the exposure for blender on many modding forums, and bring in a bunch of new users!

/d_M :smiley:

I’m giddy with happiness!

Your Script looks really good. I love Morrowind too and i also thought about moding for it. (I just bought the GotY-Edition.) There is a huge need for Blender in the MW Community, because new Models are only possible with 3dsMax. I hope Youre Scripts will break this Frontier.
I know NIF is a verry confusing Format an the Work You do is not easy.
Great RESPECT!
Doc

So far I am only importing the file, and I am making a major rework to import the proper node structure so that armature bound meshes might be importable. The script is usable as it is to import the geometries, but doesn’t yet import textures, and doesn’t yet export anything. At the current rate it will take me months to get this finished, and by that time Morrowind 2 will be out… I can only hope that the file format won’t change too much between releases.

Ok, I got a new version out, uploaded on the NIFLA page. I need to prop up a silly html page on my lycos account so that it can be downloaded by non group members, but joining the group is easy, doesn’t comport spammage and you can leave at any time. Anyway, so far I import the meshes, the vertex colors if present, the materials, and the texture images. For some reason I am not able to import the UV coordinates, even though I checked them with a little trick and found the values to be correct. If anyone wants to have a look… It’s a bit complex, though. I am already over 1000 lines of script, and growing. I only have about 7 or 8 of the nodes decoded, out of some 100 or so. If you want to try your hand at hacking the script a little experience in object oriented programming would help.

[EDIT] Oh, btw, it’s GPL, so you’re free to grab the lot, host it on a website and put the download link here, so that I don’t have to squeeze my brain for a cool webpage layout. Or if you have a page/group/repository where to host it, just PM me and I’ll be happy to upload it.

[EDIT 2] Ok, I uploaded in a nice new empty folder. Lycos allows directory browsing, but apparently doesn’t allow remote downloading of files, so I’ll just link the folder listing. http://members.lycos.co.uk/brandano/dumpbox/nifimporter/
I just hope that the directory listing actually counts as a pageview, otherwise the account will be considered idle and terminated…

No Morrowind 2. There will be Oblivion, though. That might be out in 2006 if were lucky.

/d_M

Another minor release, meaning that you won’t see major improvements in the stuff that is imported, apart for the fact that now I load the texture files when I read the materials, and a ton of other changes that are not readily appearent. Vertex normals are now imported rather than let to Blender to recalculate, all the matrix operations have been updated. The whole hierarchical structure is parsed (well, it was in 1.0a as well, I just forgot to say it) but not yest used in the mesh creation phase, and imported faces are set as smooth (same as the previous point). I am still having major troubles importing the UV coordinates. I read them fine (I tested that with a trick), I just can’t seem to be able to find the way to set them within Blender. New version can be downloaded from NIFLA or here, but if you can, please use NIFLA.

I was going to learn python just to do this script, but I never got around to it.
Well, don’t give up on the idea! This is my first Python script EVER, and I find it fairly hard to make any progress. Any help is welcome.

I know NIF is a verry confusing Format an the Work You do is not easy.
Thanks, but the credit for decoding the NIF format goes to other members of NIFLA. My only contribution to the knowledge of the NIF structure has been in examining the output of exports from 3DS Max using this importer. There’s some documentation on the NIF file structure in the NIFLA files sections, if you are interested.

Shameless bump… plus a new release. Version 1.2 alpha is out, and as usual you can grab a copy from NIFLA or on my Lycos account. New features: loads the UV coordinates properly. The original NIF format stores the UV coordinates as ‘sticky’ vertex coordinates, but as these are hard to edit within Blender (I’ll make a script for that too someday!) for the moment I load them as face UV’s. I hope to be able to re-convert these to vertex UV’s on export, creating vertex duplicates along UV seams like the original 3ds Max NIF exporter does. Textures are loaded properly, but they must be placed within the NIF file folder. So if a texture for a model is Morrowind\Data Files\Textures\aaa exture.bmp and the nif file is Morrowind\Data Files\Meshes\aaa\model.nif, you must first copy the texture to Morrowind\Data Files\Meshes\aaa\Textures\aaa exture.bmp. I know, it’s messy, but selecting a texture folder while keeping the partial relative texture path has proved to be too difficult with the actual file selector, and anyway I normally copy the models I decided to work on to a different folder. Also, if the texture for the model is a .dds file you must provide an alternative .tga, .png, .bmp or .jpg file to replace it. The script will look for one of these, as Blender doesn’t (yet?) support dds files.

My favorite pastimes are Blender and Morrowind. I’v made some models in Blender and wished they could have been imported to MW.
So good luck and appreciation for the hard work to make this happen.

Two thumbs up for the members of NIFLA!

I am starting to work on a NIF exporter now, so bringing those models to Morrowind might yet be possible, as long as these are static models or simple clothing items that do not need armature rigging. Just keep your polygon count down, tho.